# vim /usr/local/nginx/conf/nginx.conf //配置nginx文件,使其支持php
在后面新增加:
location ~ \.php$ {
root html;
fastcgi_pass unix:/tmp/php-fcgi.sock; //要和php设置里的listen = /tmp/php-fcgi.sock保持一致。
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
在
location = /50x.html {
root html;
}
去掉为root html;
index index.html index.htm;
# /usr/local/nginx/sbin/nginx –t //测试是否正常执行
# /usr/local/nginx/sbin/nginx -s reload //重新加载配置文件
创建测试文件:
#vim /usr/local/nginx/html/2.php
<?php
echo "test php scripts,hello word";
?>
# curl localhost/2.php //测试是否正常显示
#chown -R php-fpm:php-fpm data uc_server/data/ uc_client/data config //lnmp中获取DZ目录写权限
转载于:https://my.oschina.net/vpirate/blog/651406