VPS侦探论坛

 找回密码
 注册
查看: 4192|回复: 6

nginx启动失败报错说代理错?

[复制链接]
发表于 2017-1-29 19:51:25 | 显示全部楼层 |阅读模式

突然发现服务器不能访问了,就重启了一下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;
        }
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-1-30 20:37:23 | 显示全部楼层


贴一下你虚拟主机的配置文件
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-3 15:57:02 | 显示全部楼层

回复 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;
    }

上面就是虚拟主机配置。谢谢、
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-2-3 18:59:46 | 显示全部楼层

回复 3# 的帖子




你配置文件有明显的问题,每个location都少了 \
你可以自己对比一下你的nginx.conf 或 https://github.com/licess/lnmp/blob/master/conf/nginx_a.conf
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-4 11:09:04 | 显示全部楼层

回复 4# 的帖子


是这样,但是我是直接复制过来的,不知道为什么没有粘上来,
是不是因为下面这两个有什么冲突:
        include wordpress.conf;
        #error_page   404   /404.html;
        include proxy-pass-php.conf;
我去掉 include wordpress.conf;之后就可以了,这是为什么呢。?

军哥运维代购:http://shop63846532.taobao.com/

 楼主| 发表于 2017-2-4 11:12:27 | 显示全部楼层

回复 4# 的帖子


为什么反斜杠\\没有显示出来,我上一条回复输入了啊、、
发表于 2017-2-4 15:49:31 | 显示全部楼层

回复 6# 的帖子


配置文件内容建议使用“代码插入”发上来
lnmpa伪静态要使用.htaccess 直接放网站目录下,wordpress正常情况下应该会自动生成

https://lnmp.org/faq/lnmp-vhost-add-howto.html#rewrite
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-27 23:34 , Processed in 0.026417 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表