nginx 反向代理 所有请求转向处理

 

server    { 
        listen          80; 
        server_name     website.com;

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

修改完后,我们先执行:/usr/local/nginx/sbin/nginx -t 检查配置是否正常,如果显示:the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok      configuration file /usr/local/nginx/conf/nginx.conf test is successful 则正常,否则按错误提示修改配置,错误提示会精确到哪一行的。

猜你喜欢

转载自wyqjx.iteye.com/blog/1926558