1.反向代理

修改conf\nginx.conf文件, 添加proxy_pass属性

server {
        listen       7080;  #nginx 端口
        server_name  localhost; #nginx 域名

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        proxy_pass http://localhost:8080; #appserver 地址
        }

 

2.正向代理

修改conf\nginx.conf文件, 添加resolver,proxy_pass属性

server {  
    resolver 8.8.8.8; #指定DNS服务器IP地址  
    listen 8080;  
    location / {  
        proxy_pass http://$http_host$request_uri; #设定代理服务器的协议和地址  
    }  
}  

 

posted on 2017-06-03 18:17  grape1211  阅读(227)  评论(0编辑  收藏  举报