openresty解析php
openresty解析php跟nginx配置基本一样,配置如下:
vim /usr/local/openresty/nginx/conf/nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
将文件中的上段注释打开即可。
但是我配置之后对PHP脚本报404错误,之后将
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
修改为:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
即可正常运行。