[frp+nginx]实现校园网内网穿透提供http服务

/ 9,435评论 / 43226阅读 / 5点赞

注意


环境


目标效果


配置Linux服务端frps

[common]
bind_addr = 0.0.0.0              #允许客户端连接的IP;0.0.0.0表示接受所有来源
bind_port = 7000                 #frps监听端口,等待客户端来连接的端口
token = cool                     #相当于连接的密码

vhost_http_port = 10080          #服务器http服务端口

                                 #web后台管理是可以不要的
dashboard_port = 7500            #frps后台web管理端口
dashboard_user = cool            #后台管理的用户名
dashboard_pwd = coolpw           #后台管理的密码

配置Win客户端frpc

[common]
server_addr = 1.2.3.4     #服务端的机子的公网IP
server_port = 7000        #服务端的frps监听端口,需要和上面frps.ini中配置的一致
token = cool              #连接密码,需要和上面frps.ini中配置的一致

[ssh]
type = tcp                #类型
local_ip = 127.0.0.1      #要转发的端口所在的Ip
local_port = 22           #要转发的端口
remote_port = 10022       #转发到服务端的端口号

[http]
type = http               #类型
local_port = 80           #要转发的本地端口
custom_domains= *.frp.coolight.cool  #对应的域名,改成你的Linux云服务器能用的域名

配置Linux上的nginx

接下来就是要配置linux云服务器的nginx,来监听*.frp.coolight.cool的请求,并转发给Linux上的10080端口,后再由frps转发给frpc,即到达Win的80端口。

    # frp的接收http请求的反向代理
    server {
        listen 80;
        server_name *.frp.coolight.cool;        # 域名,需要改成你的

        location / {
            proxy_pass http://127.0.0.1:10080;  #你的frps监听端口
            proxy_set_header Host $host:80;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

            #proxy_set_header Upgrade $http_upgrade;
            #proxy_set_header Connection "upgrade";

            proxy_connect_timeout 7d;
            proxy_send_timeout 7d;
            proxy_read_timeout 7d;

            }


        # 防止爬虫抓取
        if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot")
            {
                return 403;
            }
}

测试运行


配置Win的nginx

现在需要让win的nginx通过判断域名的不同,来执行不同的操作(直接返回静态资源,或者再进行转发)。


nginx详细安装配置教程

参考文章:[nginx]安装配置(ubuntu/windows)

  1. Jefferyswava说道:

    mexican online pharmacies prescription drugs: mexican pharmacy online – buying prescription drugs in mexico online

  2. LarryHer说道:

    buy prescription drugs from india: indianpharmacyeasy – top 10 online pharmacy in india

  3. Jefferyswava说道:

    mexican online pharmacies prescription drugs: mexicanpharmgate.com – mexican border pharmacies shipping to usa

  4. Jefferyswava说道:

    natural ed pills: Canada pharmacy – ed supplements

  5. Тут можно преобрести сейфы оружейные сейфы для оружия

  6. LarryHer说道:

    top online pharmacy india: Indian pharmacy to USA – top 10 pharmacies in india

  7. Jamiescact说道:

    https://indianpharmacyeasy.com/# buy prescription drugs from india

  8. GlennSeade说道:

    mexican rx online Mexican Pharmacy Gate п»їbest mexican online pharmacies

  9. LarryHer说道:

    ed medication: Best Canadian pharmacy – ed meds online canada

  10. Jamiescact说道:

    http://mexicanpharmgate.com/# mexico drug stores pharmacies

  11. Тут можно преобрести оружейный сейф купить в москве оружейный сейф москва

  12. Тут можно преобрести купить несгораемый сейф сейфы огнестойкие

  13. Bradleyarrip说道:

    http://mexicanpharmgate.com/# buying prescription drugs in mexico online

  14. Bradleyarrip说道:

    http://indianpharmacyeasy.com/# india pharmacy mail order

  15. 스카이슬롯说道:

    Hi there, There’s no doubt that your web site may be having web browser compatibility problems. Whenever I look at your site in Safari, it looks fine however, when opening in Internet Explorer, it’s got some overlapping issues. I simply wanted to give you a quick heads up! Other than that, excellent website.

  16. Bradleyarrip说道:

    http://mexicanpharmgate.com/# mexican border pharmacies shipping to usa

  17. Jefferyswava说道:

    natural cure for ed: Canada pharmacy online – the best ed pills

  18. Тут можно преобрести сейфы пожаростойкие сейф огнестойкий купить

  19. Jamiescact说道:

    https://indianpharmacyeasy.com/# reputable indian pharmacies

  20. Jefferyswava说道:

    ed online pharmacy: canadian pharmacy – drugs and medications

  21. GlennSeade说道:

    discount prescription drugs canadiandrugsgate.com prescription without a doctor’s prescription

  22. GlennSeade说道:

    mexico pharmacies prescription drugs MexicanPharmGate medication from mexico pharmacy

  23. Jefferyswava说道:

    indian pharmacy: Indian pharmacy international shipping – п»їlegitimate online pharmacies india

  24. Jamiescact说道:

    https://indianpharmacyeasy.com/# best india pharmacy

  25. LarryHer说道:

    pharmacies in mexico that ship to usa: mexican drugstore online – mexican mail order pharmacies

  26. sugar defender official website Integrating Sugar Defender into my everyday regimen overall
    wellness. As someone that focuses on healthy and balanced eating, I value the additional security this supplement supplies.
    Given that starting to take it, I have actually observed a significant
    enhancement in my energy degrees and a substantial
    reduction in my need for undesirable treats such a such a profound influence on my life.

  27. Jamiescact说道:

    http://mexicanpharmgate.com/# mexican mail order pharmacies

  28. Bradleyarrip说道:

    https://indianpharmacyeasy.com/# buy medicines online in india

  29. LarryHer说道:

    world pharmacy india: Indian pharmacy international shipping – reputable indian online pharmacy

  30. Bradleyarrip说道:

    http://indianpharmacyeasy.com/# indian pharmacy online

  31. Jamiescact说道:

    https://indianpharmacyeasy.com/# Online medicine home delivery

  32. LarryHer说道:

    herbal ed treatment: Canadian pharmacy best prices – prescription drugs without prior prescription

  33. GlennSeade说道:

    best online pharmacies in mexico mexican pharmacy online medications mexico drug stores pharmacies

  34. Jamiescact说道:

    https://canadiandrugsgate.com/# best ed pills at gnc

  35. Jamiescact说道:

    http://canadiandrugsgate.com/# prescription without a doctor’s prescription

  36. Jefferyswava说道:

    п»їbest mexican online pharmacies: medicines mexico rx online – mexican mail order pharmacies

  37. Jamiescact说道:

    https://mexicanpharmgate.com/# mexican mail order pharmacies

  38. Jefferyswava说道:

    viagra without a doctor prescription walmart: Best Canadian pharmacy – pain meds without written prescription

  39. Jamiescact说道:

    https://indianpharmacyeasy.com/# reputable indian pharmacies

  40. GlennSeade说道:

    buy ed pills Canadian pharmacy best prices tadalafil without a doctor’s prescription

  41. Jamiescact说道:

    http://indianpharmacyeasy.com/# pharmacy website india

  42. LarryHer说道:

    buy cheap prescription drugs online: canadian pharmacy – natural ed remedies

  43. Jamiescact说道:

    http://indianpharmacyeasy.com/# top 10 online pharmacy in india

  44. Тут можно преобрести сейфы огнестойкие огнеупорные сейфы

  45. Bradleyarrip说道:

    https://canadiandrugsgate.com/# ways to treat erectile dysfunction

  46. Bradleyarrip说道:

    http://canadiandrugsgate.com/# buy prescription drugs

  47. LarryHer说道:

    herbal ed treatment: Best Canadian pharmacy – erectile dysfunction cure

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注