按照网上的教程部署之后,可以访问html页面,但是每次把主页改成index.php页面就完全是空白,查了一天没查到原因,
后来看了有个人的博客之后,看到他的配置稍有不同,修改之后就可以了。
nginx的站点配置文件里面(比如,默认的/etc/nginx/sites-available/default)
php配置里面要加上下面这句,否则php脚本不能执行
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # 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;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #必须加上这一行
include fastcgi_params;