码迷,mamicode.com
首页 > 其他好文 > 详细

LNMP安装后子域名访问工程报错502 Bad Gateway

时间:2018-07-26 20:03:39      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:clu   path   文件   sql   vhost   报错   fas   comment   location   

LNMP安装好nginx、mysql、php后,放好代码,搭建完数据库,使用

IP/工程名

可以正常访问,但是给这个工程配置了子域名,用子域名访问就直接报错

502 Bad Gateway

解决这个问题,进入到PHP安装目录,比如/usr/local/php/conf,编辑文件php-fpm.conf,将

[www]
listen = /tmp/php-cgi.sock

修改为:

[www]
listen = 127.0.0.1:9000

其中,这个修改的端口9000,可以从nginx的配置中获取,查看nginx的目录,比如/usr/local/nginx/conf/vhost,找到配置这个工程子域名的文件,查看

location ~ [^/]\.php(/|$)
    {
        # comment try_files $uri =404; to enable pathinfo
        try_files $uri =404;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi.conf;
        #include pathinfo.conf;
    }

 

 

OK。保存重启即可。

 

LNMP安装后子域名访问工程报错502 Bad Gateway

标签:clu   path   文件   sql   vhost   报错   fas   comment   location   

原文地址:https://www.cnblogs.com/xianxh/p/9373650.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!