Nginx源码编译安装,php7.1源码编译安装,nginx配置域名虚拟主机后,访问html页面正常,访问php页面时会有报错提醒:
查询nginx虚拟主机配置,确认正确,配置文件如下:
##conf/vhost server { listen 80; server_name my.orcy.net.cn; #charset koi8-r; #access_log logs/host.access.log main; access_log logs/my.orcy.net.cn.log main; error_log logs/my.orcy.net.cn.error.log; location / { root /srv/www/html; index index.php index.html index.htm; } location ~ \.php$ { root /srv/www/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 404 /404.html; location = /404.html { root html; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
查看nginx错误日志:error_log logs/my.orcy.net.cn.error.log
[error] 11560#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 10.24.10.19, server: my.orcy.net.cn, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "my.orcy.net.cn"
确认应该是php-fpm未正常运行,查看php-fpm状态
#ps aux|grep php-fpm
果然是,php-fpm服务未正常运行,手动启动php-fpm
网页访问正常,问题解决,如下图,但是php-fpm无法后台运行,退出或crtl+c会导致php-fpm结束,如何让php-fpm后台运行,请查看《 启动php-fpm无法后台运行,退出或crtl+c会导致php-fpm结束解决办法 》
nginx虚拟主机配置文件下载
nginx+php虚拟主机配置文件:
https://download.csdn.net/download/i12344/12244635
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)