I am having a problem with PHP and virtual hosts on Nginx. See below for config. Site 1 works perfectly. But, for the default site, the PHP file is downloaded to the browser rather than executed.
Any ideas?
nginx.conf
------------------------------------------------
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80 default;
server_name _;
root /path_to_default;
index iindex.php ndex.html ;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /path_to_default$fastcgi_script_name;
}
}
# Site 1
#
server {
listen 80;
server_name site1;
root /path_to_site1;
index index.php index.html ;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /path_to_site1$fastcgi_script_name;
}
}
}