本帖最后由 toot 于 2022-2-10 17:33 编辑
有人经常问我
那就发一下吧,就这么简单
宝塔不需要开启不需要带https
cf设置为灵活就好了
我的镜像站为什么开启5秒盾。因为loc主站有防cc策略,同一个ip刷新太快就会封禁12小时。反代站所有访问者ip都是反代站一个ip抵达主站。道理懂了吧
没用宝塔的把下面代码放进nginx配置文件
- location ^~ /
- {
- proxy_pass https://hostloc.com;
- proxy_set_header Host www.hostloc.me;
- 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;
-
- #Persistent connection related configuration
-
- add_header X-Cache $upstream_cache_status;
-
- #Set Nginx Cache
-
- proxy_set_header Accept-Encoding "";
- sub_filter "hostloc.com" "www.hostloc.me";
- sub_filter "www.hostloc.com" "www.hostloc.me";
- sub_filter_once off;
-
-
- set $static_fileEJLfi5A0 0;
- if ( $uri ~* ".(gif|png|jpg|css|js|woff|woff2)$" )
- {
- set $static_fileEJLfi5A0 1;
- expires 12h;
- }
- if ( $static_fileEJLfi5A0 = 0 )
- {
- add_header Cache-Control no-cache;
- }
- }
复制代码
|