说一下我的目的把,我就是想通过反向代理来隐藏掉后面的端口号,如果有更好的方法也可以和我说一下。这是我在站点的反向代理里配置的
- #PROXY-START/
- location ^~ /
- {
- proxy_pass http://kdy-zzy.freespider.cn:731;
- proxy_set_header Host kdy-zzy.freespider.cn;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header REMOTE-HOST $remote_addr;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- # proxy_hide_header Upgrade;
- add_header X-Cache $upstream_cache_status;
- #Set Nginx Cache
-
- proxy_set_header Accept-Encoding "";
- sub_filter "http://kdy-zzy.freespider.cn:731" "http://kdy-zzy.freespider.cn";
- sub_filter_once off;
-
- set $static_fileZW7sGwrY 0;
- if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)[ DISCUZ_CODE_0 ]quot; )
- {
- set $static_fileZW7sGwrY 1;
- expires 12h;
- }
- if ( $static_fileZW7sGwrY = 0 )
- {
- add_header Cache-Control no-cache;
- }
- }
- #PROXY-END/
复制代码 现在只要开启反向代理就无法访问,如果不开就只能通过域名+端口号访问
|
|