全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2173|回复: 12

loc反代教程来了

[复制链接]
发表于 2022-2-10 17:12:36 | 显示全部楼层 |阅读模式
本帖最后由 toot 于 2022-2-10 17:33 编辑

有人经常问我

那就发一下吧,就这么简单



宝塔不需要开启不需要带https

cf设置为灵活就好了

我的镜像站为什么开启5秒盾。因为loc主站有防cc策略,同一个ip刷新太快就会封禁12小时。反代站所有访问者ip都是反代站一个ip抵达主站。道理懂了吧

没用宝塔的把下面代码放进nginx配置文件

  1. location ^~ /
  2. {
  3.     proxy_pass https://hostloc.com;
  4.     proxy_set_header Host www.hostloc.me;
  5.     proxy_set_header X-Real-IP $remote_addr;
  6.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  7.     proxy_set_header REMOTE-HOST $remote_addr;

  8.     #Persistent connection related configuration

  9.     add_header X-Cache $upstream_cache_status;

  10.     #Set Nginx Cache

  11.     proxy_set_header Accept-Encoding "";
  12.         sub_filter "hostloc.com" "www.hostloc.me";
  13.         sub_filter "www.hostloc.com" "www.hostloc.me";
  14.     sub_filter_once off;

  15.    
  16.     set $static_fileEJLfi5A0 0;
  17.     if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
  18.     {
  19.             set $static_fileEJLfi5A0 1;
  20.             expires 12h;
  21.         }
  22.     if ( $static_fileEJLfi5A0 = 0 )
  23.     {
  24.     add_header Cache-Control no-cache;
  25.     }
  26. }
复制代码
发表于 2022-2-10 17:13:42 | 显示全部楼层
好的,马上反代
                                                      
表妹 该用户已被删除
发表于 2022-2-10 17:14:59 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2022-2-10 17:20:45 | 显示全部楼层
马上反代www.hostloc.me
发表于 2022-2-10 17:21:45 | 显示全部楼层
直接这样子可以回复吗
 楼主| 发表于 2022-2-10 17:22:54 | 显示全部楼层
3351239779 发表于 2022-2-10 17:21
直接这样子可以回复吗

可以啊。我现在用的就是我签名的
发表于 2022-2-10 17:23:30 | 显示全部楼层
大佬很多啊
发表于 2022-2-10 17:24:55 | 显示全部楼层
我是用lnmp反代的。看我签名。
发表于 2022-2-10 17:28:36 | 显示全部楼层
可以来个不带宝塔的教程吗? 大佬
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-5-4 18:54 , Processed in 0.065098 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表