My nginx + fastcgi configuration downloads php files instead of executing them -
i'm using configuration on fresh install of php5-fpm , nginx on ubuntu 13.04:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; server_name localhost; location / { try_files $uri $uri/ /index.html; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; allow ::1; deny all; } error_page 404 /404.html; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # note: should have "cgi.fix_pathinfo = 0;" in php.ini # php5-cgi alone: fastcgi_pass 127.0.0.1:9000; # php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } }
but, web browser seeing php text instead of executed results. should troubleshoot?
your php code being displayed directly because it's not being sent php engine, means location block being matched , php file being served, php file isn't being captured php block, problem in php block.
in block have 2 fastcgi_pass
, 1 port (9000) , other unix socket, can't have both together, since you've tagged question fastcgi i'll assume using fastcgi, try commenting line
#fastcgi_pass unix:/var/run/php5-fpm.sock;
Comments
Post a Comment