I setup a wordpress droplet on Ubuntu and the first site I have on there works fine. I wanted to add a second site to the server so I followed the instructions here. Granted, these are specific to apache and I’m on nginx, they should be pretty close.
When I go to the site, I get a 403 Forbidden and the following error in my nginx error log:
2017/02/17 00:53:04 [error] 29074#29074: *5 directory index of “/var/www/lazerusdesigns/” is forbidden, client: 73.60.85.71, server: www.lazerusdesigns.com, request: “GET / HTTP/1.1”, host: “www.lazerusdesigns.com”
2017/02/17 00:53:04 [error] 29074#29074: *6 open() “/var/www/lazerusdesigns/favicon.ico” failed (2: No such file or directory), client: 73.60.85.71, server: www.lazerusdesigns.com, request: “GET /favicon.ico HTTP/1.1”, host: “www.lazerusdesigns.com”
I tried checking the permissions on the folder and files where the site is stored.
In my wordpress file in sites-available, I added the following:
server { root /var/www/lazerusdesigns; server_name www.lazerusdesigns.com; access_log /var/log/nginx/www.lazerusdesigns.com.access.log; error_log /var/log/nginx/www.lazerusdesigns.com.error.log; location ~.php$ { include snippets/fastcgi-php.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
I’m at a loss. Any thoughts anyone? BTW, I’m no linux guru so you may have to spell out what you’re thinking lol.
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!
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.
Okay, its fixed. I had to open my php.ini file and change the value of cgi.fix_pathinfo from 0 to 1.
So I made the changes you suggested but now I’m getting a 403 Forbidden. My other website is still up though so that’s good.
This is the error.log now.
@jlazerus
In the new server block I provided, replace:
… with (i.e use only my configuration, none of the custom configuration you have right now):
If you want to change
/etc/nginx/fastcgi_params
, you can make a backup:Remove it:
And then create a new one:
… and paste in:
You’d then reload NGINX:
or
The above is, of course, assuming you have PHP-FPM setup to use TCP instead of the default socket.
To check this, you’d need to change to your PHP-FPM directory:
The above should put you in the correct directory. You’d then edit the file inside and look for the
listen
directive and make sure it’s set to127.0.0.1:9000
.@jlazerus
What you should end up with is this:
Its fixed. I had to edit my php.ini and change the value of cgi.fix_pathinfo from 0 to 1.
@jlazerus
What’s inside the file below?
Also, just a quick restructure of your server block, just to keep things a little more organized and add a bit that’s missing.
Thanks for the response. My fastcgi-php.conf is below. Thanks too for the tips on fixing the server block. I’ll do that now.
If I add
index index.php;
to my server block, I get a 502 error again.