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

/ 9,031评论 / 42229阅读 / 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. Keithknony说道:

    https://gatesofolympus.auction/# pragmatic play gates of olympus

  2. Franknix说道:

    aviator oyunu 100 tl: aviator sinyal hilesi ucretsiz – aviator oyunu

  3. ecommerce说道:

    Howdy! Do you know if they make any plugins to help
    with Search Engine Optimization? I’m trying to get my blog
    to rank for some targeted keywords but I’m not seeing very good
    success. If you know of any please share. Thank you!

    You can read similar art here: Sklep online

  4. Franknix说道:

    2024 en iyi slot siteleri: en yeni slot siteleri – casino slot siteleri

  5. WilliamDer说道:

    gates of olympus taktik: pragmatic play gates of olympus – gates of olympus demo

  6. Keithknony说道:

    http://sweetbonanza.bid/# sweet bonanza kazanc

  7. Franknix说道:

    slot siteleri 2024: en iyi slot siteleri 2024 – yeni slot siteleri

  8. Keithknony说道:

    http://slotsiteleri.guru/# slot kumar siteleri

  9. Franknix说道:

    aviator oyunu 20 tl: aviator oyunu giris – aviator sinyal hilesi apk

  10. WilliamDer说道:

    pin-up online: pin up bet – pin up giris

  11. Franknix说道:

    aviator sinyal hilesi ucretsiz: aviator oyunu – aviator oyna 20 tl

  12. fashionflag http://www.hd porn video.com fashionflag.6Z1FGk6WwV1

  13. Franknix说道:

    aviator oyunu giris: aviator bahis – aviator oyna

  14. Jamesnew说道:

    legitimate online pharmacy no prescription medication online without prescription no prescription drugs online

  15. Robinvew说道:

    https://indianpharm.shop/# Online medicine order

  16. e-commerce说道:

    Valuable info. Fortunate me I discovered your site by chance, and I am stunned why this accident didn’t happened in advance! I bookmarked it. expand your blogexpander

  17. CarlosSeill说道:

    http://pharmacynoprescription.pro/# online medication without prescription

  18. Jamiehob说道:

    reputable mexican pharmacies online: buying from online mexican pharmacy – reputable mexican pharmacies online

  19. RalphRaf说道:

    purple pharmacy mexico price list: pharmacies in mexico that ship to usa – buying from online mexican pharmacy

  20. Robinvew说道:

    http://mexicanpharm.online/# buying prescription drugs in mexico online

  21. RalphRaf说道:

    canadian drugs online: canadian pharmacy near me – canadian drug pharmacy

  22. Robinvew说道:

    https://pharmacynoprescription.pro/# canadian pharmacy no prescription required

  23. Robinvew说道:

    http://pharmacynoprescription.pro/# mexican pharmacy no prescription

  24. RalphRaf说道:

    certified canadian pharmacy: canadian pharmacy 24 – pharmacy canadian superstore

  25. Robinvew说道:

    https://indianpharm.shop/# top 10 online pharmacy in india

  26. CarlosSeill说道:

    https://canadianpharm.guru/# canadian pharmacy reviews

  27. Robinvew说道:

    http://mexicanpharm.online/# medication from mexico pharmacy

  28. Jamesnew说道:

    top online pharmacy india online shopping pharmacy india best online pharmacy india

  29. Robinvew说道:

    http://canadianpharm.guru/# canadian pharmacy near me

  30. CarlosSeill说道:

    https://mexicanpharm.online/# п»їbest mexican online pharmacies

  31. RalphRaf说道:

    Online medicine home delivery: mail order pharmacy india – top 10 pharmacies in india

  32. RalphRaf说道:

    canadian family pharmacy: real canadian pharmacy – legit canadian pharmacy online

  33. Robinvew说道:

    https://canadianpharm.guru/# canada drugs reviews

  34. Jamiehob说道:

    buy prescription drugs from india: Online medicine order – mail order pharmacy india

  35. Jamesnew说道:

    online shopping pharmacy india Online medicine order buy medicines online in india

  36. Robinvew说道:

    https://mexicanpharm.online/# pharmacies in mexico that ship to usa

  37. RalphRaf说道:

    best canadian pharmacy to order from: best online canadian pharmacy – canadian pharmacy cheap

  38. RalphRaf说道:

    mexican pharmacy: medicine in mexico pharmacies – mexico pharmacies prescription drugs

  39. Robinvew说道:

    http://mexicanpharm.online/# п»їbest mexican online pharmacies

  40. CarlosSeill说道:

    https://mexicanpharm.online/# medication from mexico pharmacy

  41. Robinvew说道:

    http://canadianpharm.guru/# drugs from canada

  42. Jamesnew说道:

    buy drugs online without prescription canada drugs without prescription prescription meds from canada

  43. Jamiehob说道:

    medication from mexico pharmacy: mexican pharmaceuticals online – mexican online pharmacies prescription drugs

  44. RalphRaf说道:

    canadian pharmacy victoza: online canadian pharmacy review – canadian pharmacy prices

  45. Robinvew说道:

    http://indianpharm.shop/# online shopping pharmacy india

  46. RalphRaf说道:

    buy prescription drugs from india: cheapest online pharmacy india – india pharmacy mail order

  47. CarlosSeill说道:

    https://canadianpharm.guru/# reputable canadian online pharmacy

  48. Robinvew说道:

    https://mexicanpharm.online/# buying from online mexican pharmacy

  49. Jamesnew说道:

    Online medicine home delivery mail order pharmacy india india pharmacy mail order

  50. Robinvew说道:

    https://indianpharm.shop/# mail order pharmacy india

发表回复

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