国产欧美日韩第一页|日本一二三不卡视频|在线精品小视频,亚洲第一免费播放区,metcn人体亚洲一区,亚洲精品午夜视频

如何用nginx做反向代理

2016-11-20 00:31:40 8528

1.nginx/conf目錄中創(chuàng)建文件proxy.conf以方便在建立站點(diǎn)的時候引用

 proxy_connect_timeout 300s;

  proxy_send_timeout 900;

  proxy_read_timeout 500;

  proxy_buffer_size 32k;

  proxy_buffers  4 32k;

  proxy_busy_buffers_size 64k;

  proxy_redirect off;

  proxy_hide_header Vary;

  proxy_set_header Accept-Encoding '';

  proxy_set_header host $host;

  proxy_set_header Referer $http_referer;

  proxy_set_header Cookie $http_cookie;

  proxy_set_header X-Real-Ip $remote_addr;

  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

  expires 10d;

2.建立站點(diǎn)

server{

       listen 80;

       #listen [::]:80;

       server_name www.tjdsmy.cn website.com;

       index index.html index.htm index.php default.html default.htm default.php index.asp default.asp;

       location / {

             #ModSecurityEnabled off;

             #ModSecurityConfig modsecurity.conf;

       }

       location ~ .*.(php)(.*){

             proxy_pass http://www.tjdsmy.cn;

             include /etc/nginx/proxy.d/proxy.conf;

       }

       location ~ .*.(asp)(.*){

             proxy_pass http://www.tjdsmy.cn;

             include /etc/nginx/proxy.d/proxy.conf;

       }

       location ~ .*.(gif|jpg|png|htm|html|css|js|flv|ico|swf)(.*) {

            #include cache.conf;

            proxy_pass http://www.tjdsmy.cn ;

            include /etc/nginx/proxy.d/proxy.conf;

        }

}

:代理只是一個中介服務(wù),歸根揭底還是要被代理的服務(wù)能正常訪問還要代理的服務(wù)配置正確


提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: