Greetings,
Have followed the tutorial but now when I enter site via url I get ERR_CONNECTION_REFUSED. The log in /var/log/nginx are empty.
Followed the tutorial found here https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
What I also did was that I removed the default file from sites-available and from sites-enabled.
sudo ufw status gives me inactive.
Could it be a linux permission issue? Folder structure looks like this /var/www/mysite.com/html
drwxr-xr-x 3 root root 4096 May 2 20:05 www drwxr-xr-x 3 root root 4096 May 2 17:18 mysite.com drwxr-xr-x 11 blizzard blizzard 4096 Apr 5 2016 html
Used before nginx with older version of Ubuntu but this I dont know how to fix… Ideas?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
@broodforge
There’s a few things we can check, though first I’d simplify your server block to avoid any potential issues. Stripping out the comments and configuration that isn’t helping would look like this the below.
I’ll use this to build on, so make sure you check the bottom of the post for the actual configuration.
When it comes to configuration, if you don’t need it, don’t include it – just to keep things clean.
Now, when it comes to PHP-FPM, ideally, I’d change this block:
to this:
I would then backup
snippets/fastcgi-php.conf
and replace everything in it with:So what we end up with us a server block that looks like:
Beyond the changes to how PHP is handled, everything else looks good unless you’re using WordPress, in which case I’d change one more line:
try_files $uri $uri/ =404;
=>try_files $uri $uri/ /index.php?$args;
…
Once the changes have been made, run
service nginx restart
and then check to see if NGINX is running as expected.…
That being said, also on the PHP-FPM side, you need to make sure that your files and directories are owned by the same user that PHP-FPM is running as. In most cases, on an un-modified version (i.e. you’ve not created additional pool files), that’ll be
www-data
, so I’d run:and make sure PHP-FPM is indeed running as well.
Hmmmm…it could be a php issue… Darn…how to check if PHP is running?
@broodforge
Please post your server block configuration – starting with
server {
and ending with}
.If NGINX isn’t running, nothing will be logged to NGINX’s error or access logs, so we need to check the server block(s) and then make sure NGINX is actually running as expected.
Hi @broodforge
Did you change the parameter
error_log
in your Nginx configuration? By default you should have a file/var/log/nginx/error.log
which is created and contains information (no matter if there is errors or not, since it will log every time you restart Nginx).Is Nginx even running?
service nginx status