Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Changed Root Path, PHP not working any more

$
0
0
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;
}

}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>