I have a Ubuntu 16.04 droplet: It’s a pure all-default LEMP environment.
I’ve added the following global conf to the http block inside nginx.conf.
The purpose is to cover app all 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;
}
}
..........................................
}
The problem is that this configuration breaks the system - as long as it’s inside nginx.conf, the system breaks.
The full nginx.conf can be seen here.
Why does my global code breaks Nginx?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
The dots where there only for example, but it seems my entire approach here was wrong. I had to use the file etc/sites-available/default instead (without changing the nginx.conf). That’s my current conf in the default file:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
If those lines of dots
..........................................
If they exist in your actual configuration file are likely the issue and should be removed.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.