Welcome! Log In Create A New Profile

Advanced

Changed Root Path, PHP not working any more

Posted by maikkel 
Changed Root Path, PHP not working any more
February 24, 2014 06:01PM
Hello, I'm new to nginx so i'm sure i'm missing something basic...

I installed php and nginx on debian wheezy (virtualbox machine). Everything worked fine when I left the default root path at /usr/share/nginx/www. As soon as I change it to /var/www, php doesn't work any more (tags & commands are output to html text instead of interpreted).

Could there be some php setting i've missed?


This works:

server {
listen 80;
listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name localhost;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
##fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}




This doesn't:

server {
listen 80;
listen [::]:80 default_server ipv6only=on;

root /var/www;

index index.php index.html index.htm;

server_name localhost;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
##fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 253
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready