Welcome! Log In Create A New Profile

Advanced

Apache to Nginx - Ubuntu

Posted by grevan 
Apache to Nginx - Ubuntu
July 27, 2015 04:03PM
Hi all,
Ubuntu 12.04, i´m trying to migrate my site from Apache to Nginx but i´m getting a 403 Forbidden message. Can anyone help me? This is my "/etc/nginx/sites-available/default"

server {
listen 80;

root /srv/www/mysite;
index index.php index.html index.htm;

server_name mydomain.com www.mydomain.com;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ /\. {
deny all;
}

location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
}

and here is the error.log:

2015/07/24 15:41:10 [error] 21834#0: *775 directory index of "/srv/www/" is forbidden, client: 108.162.210.206, server: mydomain.com, request: "GET / HTTP/1.1", host: "www.mydomain.com"

Can anyone help me?
Re: Apache to Nginx - Ubuntu
September 08, 2015 02:57PM
I'm new to nginx too but did you check the permissions? I believe, by default, nginx on ubuntu runs as the www-data user and you may also want to check what user your php-fpm is running as (/etc/php5/fpm/pool.d/www.conf). Sounds like that user can't see/read /srv/www/.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 56
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready