VPS侦探论坛

标题: nginx启动失败报错说代理错? [打印本页]

作者: a172606220    时间: 2017-1-29 19:51
标题: nginx启动失败报错说代理错?
突然发现服务器不能访问了,就重启了一下lnmp试试,结果出现下面的问题:
Starting LNMPA...
Starting nginx... nginx: [emerg] duplicate location "/" in /usr/local/nginx/conf/proxy-pass-php.conf:2
failed

还有:/usr/local/nginx/sbin/nginx -t
nginx: [emerg] duplicate location "/" in /usr/local/nginx/conf/proxy-pass-php.conf:2
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
请问这是什么情况,上次登录还是正常的,请大神指导。谢谢

默认配置文件如下,我没改过:
        location /
        {
            try_files $uri @apache;
        }

        location @apache
        {
            internal;
            proxy_pass http://127.0.0.1:88;
            include proxy.conf;
        }

        location ~ [^/]\.php(/|$)
        {
            proxy_pass http://127.0.0.1:88;
            include proxy.conf;
        }
作者: licess    时间: 2017-1-30 20:37
贴一下你虚拟主机的配置文件
作者: a172606220    时间: 2017-2-3 15:57
标题: 回复 2# 的帖子
server
    {
        listen 80;
        #listen [::]:80;
        server_name www.abc1234.com abc1234.com;
        if ($host != 'www.abc1234.com' ) {
        rewrite ^/(.*)$ http://www.abc1234.com/$1
        permanent;
        }
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/www.abc1234.com;

        include wordpress.conf;
        #error_page   404   /404.html;
        include proxy-pass-php.conf;

        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.
        {
            deny all;
        }

        access_log  /home/wwwlogs/www.abc1234.com.log;
    }

上面就是虚拟主机配置。谢谢、
作者: licess    时间: 2017-2-3 18:59
标题: 回复 3# 的帖子
你配置文件有明显的问题,每个location都少了 \
你可以自己对比一下你的nginx.conf 或 https://github.com/licess/lnmp/blob/master/conf/nginx_a.conf
作者: a172606220    时间: 2017-2-4 11:09
标题: 回复 4# 的帖子
是这样,但是我是直接复制过来的,不知道为什么没有粘上来,
是不是因为下面这两个有什么冲突:
        include wordpress.conf;
        #error_page   404   /404.html;
        include proxy-pass-php.conf;
我去掉 include wordpress.conf;之后就可以了,这是为什么呢。?
作者: a172606220    时间: 2017-2-4 11:12
标题: 回复 4# 的帖子
为什么反斜杠\\没有显示出来,我上一条回复输入了啊、、
作者: licess    时间: 2017-2-4 15:49
标题: 回复 6# 的帖子
配置文件内容建议使用“代码插入”发上来
lnmpa伪静态要使用.htaccess 直接放网站目录下,wordpress正常情况下应该会自动生成

https://lnmp.org/faq/lnmp-vhost-add-howto.html#rewrite




欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/) Powered by Discuz! X3.4