I've added the following global conf to the http
block inside nginx.conf
.
The purpose is to cover all php apps (WordPress apps and PHPmyadmin) in one block of conf, instead creating multiple conf files and their symlinks.
http {
..........................................
server {
listen 80 default_server;
root /var/www/$host;
location / {
index index.php index.html index.htm;
}
location ~ {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
..........................................
}
My problem
This configuration breaks the system - as long as it's inside nginx.conf
, the system breaks.
The full (updated) nginx.conf
can be seen here.
The only error in nginx -t
is regarding this line listen 80 default_server;
and it says:
a duplicate default server for 0.0.0.0:80 in /etc/nginx/nginx.conf:65
My question
Why does my global code breaks Nginx?