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

/ 8,997评论 / 42161阅读 / 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. JeromedUb说道:

    diflucan 750 mg diflucan usa diflucan 150 mg cost

  2. JamesSew说道:

    tamoxifen hip pain: nolvadex only pct – tamoxifen postmenopausal

  3. JeromedUb说道:

    buy cytotec in usa buy cytotec online buy cytotec pills online cheap

  4. Archierut说道:

    http://nolvadex.icu/# п»їdcis tamoxifen

  5. Williamzew说道:

    tamoxifen warning: aromatase inhibitors tamoxifen – tamoxifen and antidepressants

  6. JeromedUb说道:

    200 mg doxycycline order doxycycline doxycycline 200 mg

  7. JeromedUb说道:

    buy doxycycline monohydrate doxycycline hyclate order doxycycline 100mg without prescription

  8. JamesSew说道:

    buy doxycycline without prescription: buy doxycycline monohydrate – doxycycline hyclate 100 mg cap

  9. Archierut说道:

    https://diflucan.icu/# cost of diflucan over the counter

  10. JeromedUb说道:

    ciprofloxacin 500 mg tablet price ciprofloxacin generic cipro pharmacy

  11. JeromedUb说道:

    ciprofloxacin over the counter ciprofloxacin 500mg buy online purchase cipro

  12. Williamzew说道:

    cipro pharmacy: ciprofloxacin order online – buy cipro online

  13. JeromedUb说道:

    buy cipro online canada purchase cipro buy cipro online canada

  14. JeromedUb说道:

    buy diflucan online cheap diflucan over the counter singapore candida diflucan

  15. JamesSew说道:

    antibiotics cipro: ciprofloxacin generic price – п»їcipro generic

  16. Archierut说道:

    http://doxycyclinest.pro/# doxycycline 100mg capsules

  17. JeromedUb说道:

    п»їcytotec pills online buy cytotec online buy cytotec pills online cheap

  18. JeromedUb说道:

    diflucan oral diflucan cream over the counter buy diflucan online india

  19. Williamzew说道:

    Misoprostol 200 mg buy online: Abortion pills online – buy cytotec

  20. JamesSew说道:

    buy cytotec: buy misoprostol over the counter – buy cytotec over the counter

  21. Archierut说道:

    https://doxycyclinest.pro/# doxycycline 100mg price

  22. JeromedUb说道:

    doxycycline tetracycline purchase doxycycline online buy generic doxycycline

  23. JeromedUb说道:

    buy generic ciprofloxacin ciprofloxacin generic price ciprofloxacin over the counter

  24. JamesSew说道:

    doxycycline order online: doxycycline 200 mg – doxycycline 150 mg

  25. Williamzew说道:

    how to get diflucan online: diflucan generic – can you buy diflucan over the counter in australia

  26. JeromedUb说道:

    Cytotec 200mcg price cytotec buy online usa Abortion pills online

  27. JamesSew说道:

    Misoprostol 200 mg buy online: cytotec online – buy cytotec online

  28. Archierut说道:

    https://ciprofloxacin.guru/# п»їcipro generic

  29. Chasetit说道:

    indian pharmacy online: Generic Medicine India to USA – indianpharmacy com

  30. LarryAntic说道:

    online canadian pharmacy reviews My Canadian pharmacy safe reliable canadian pharmacy

  31. DavidMus说道:

    indianpharmacy com: Online medicine order – reputable indian online pharmacy

  32. LarryAntic说道:

    reputable canadian pharmacy International Pharmacy delivery canada ed drugs

  33. LamarViz说道:

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

  34. DavidMus说道:

    online canadian drugstore: CIPA approved pharmacies – canadian neighbor pharmacy

  35. LarryAntic说道:

    buy medicines online in india indian pharmacy delivery world pharmacy india

  36. LarryAntic说道:

    india pharmacy indian pharmacy pharmacy website india

  37. Chasetit说道:

    mexican drugstore online: mexican pharmaceuticals online – mexican mail order pharmacies

  38. LamarViz说道:

    buying from online mexican pharmacy: Pills from Mexican Pharmacy – mexican drugstore online

  39. LarryAntic说道:

    buying from online mexican pharmacy mexican drugstore online mexican mail order pharmacies

  40. LarryAntic说道:

    india pharmacy mail order indian pharmacy delivery indian pharmacy paypal

  41. LamarViz说道:

    mexico drug stores pharmacies: online pharmacy in Mexico – mexican pharmaceuticals online

  42. DavidMus说道:

    www canadianonlinepharmacy: Cheapest drug prices Canada – best online canadian pharmacy

  43. Chasetit说道:

    mexican border pharmacies shipping to usa: online pharmacy in Mexico – pharmacies in mexico that ship to usa

  44. LarryAntic说道:

    п»їlegitimate online pharmacies india Generic Medicine India to USA online pharmacy india

  45. LarryAntic说道:

    canadian drug pharmacy International Pharmacy delivery canadian pharmacy checker

  46. DavidMus说道:

    buy prescription drugs from india: best india pharmacy – world pharmacy india

  47. LarryAntic说道:

    Online medicine home delivery indian pharmacy online shopping pharmacy india

  48. LarryAntic说道:

    canadian pharmacy no scripts best canadian online pharmacy best rated canadian pharmacy

  49. LamarViz说道:

    certified canadian pharmacy: Canada pharmacy online – canadian family pharmacy

  50. Chasetit说道:

    canadian mail order pharmacy: Best Canadian online pharmacy – best online canadian pharmacy

发表回复

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