我使用的是一個新的PHP5-FPM和Nginx的在Ubuntu 13.04安裝此配置:我的nginx + FastCGI配置下載PHP文件,而不是執行它們
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: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
但是,我的Web瀏覽器中看到的PHP作爲文本而不是執行結果。我應該在哪裏尋找疑難解答?
這是奇怪的。我能夠看到fastcgi正在運行,但無法使用任何一條線路來連接php輸出。我重新安裝了一切,並遵循本指南(http://askubuntu.com/questions/134666/what-is-the-easiest-way-to-enable-php-on-nginx),似乎一切正常。謝謝! – arby