VPS侦探论坛

 找回密码
 注册
查看: 4938|回复: 2

求助0.8一键包做反向代理的问题

[复制链接]
发表于 2012-1-30 09:54:42 | 显示全部楼层 |阅读模式

https://www.vpser.net/manage/linux-vps-nginx-reverse-proxy.html

按照这个连接上的操作 出现
[root@localhost ~]# /usr/local/nginx/sbin/nginx -t
nginx: [emerg] unknown directive "server" in /usr/local/nginx/conf/nginx.conf:122
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
而122行开始就是那段添加的代码如下
server
    {
        listen          80;
        server_name     localhost;

        location / {
            proxy_pass              http://www.baidu.com/;
            proxy_redirect          off;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    }

请问要怎么办?是哪里没弄对么?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-1-30 12:22:48 | 显示全部楼层


像是你这个server段放错地方了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-1-30 13:27:22 | 显示全部楼层

location / {
            proxy_pass              http://www.baidu.com/;
            proxy_redirect          off;
            proxy_set_header        X-Real-IP       $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            }


原来只要这段加到server那段就可以了。。。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-22 05:29 , Processed in 0.025595 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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