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

/ 2,762评论 / 13889阅读 / 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. e-commerce说道:

    Wow, fantastic blog layout! How lengthy have you
    been blogging for? you made blogging look easy. The
    whole look of your website is excellent, let alone the content material!
    You can see similar here najlepszy sklep

  2. PhilipBup说道:

    boner pills online buy ed pills cheap ed medication

  3. HarveyBox说道:

    http://medicationnoprescription.pro/# online drugs no prescription

  4. MatthewDoolo说道:

    ed treatments online: cheap ed medicine – ed medicines

  5. AustinWhoto说道:

    best online ed medication: online erectile dysfunction medication – cheapest ed meds

  6. BrainSaw说道:

    http://prednisonea.store/# ordering prednisone

  7. JamesLot说道:

    zithromax without prescription zithromax cost buy cheap zithromax online

  8. DomenicDobby说道:

    where to buy clomid without prescription: order clomid without rx – can i get generic clomid

  9. JamesLot说道:

    amoxicillin 800 mg price amoxicillin 875 125 mg tab amoxicillin without rx

  10. BrainSaw说道:

    https://clomida.pro/# can you buy cheap clomid

  11. BryanSturf说道:

    amoxicillin order online: amoxicillin 50 mg tablets – amoxicillin 30 capsules price

  12. BrainSaw说道:

    https://azithromycina.pro/# generic zithromax 500mg india

  13. Josephtrink说道:

    http://stromectola.top/# ivermectin 4000

  14. JamesLot说道:

    prednisone price prednisone 5093 prednisone 20

  15. JamesLot说道:

    how can i get generic clomid price where buy cheap clomid buy clomid no prescription

  16. DomenicDobby说道:

    can i buy clomid without rx: can you buy generic clomid – cost of cheap clomid pill

  17. BrainSaw说道:

    https://clomida.pro/# cost cheap clomid price

  18. Josephtrink说道:

    http://azithromycina.pro/# zithromax for sale 500 mg

  19. JamesLot说道:

    can i get clomid prices where can i buy cheap clomid without rx can i get generic clomid

  20. BrainSaw说道:

    http://azithromycina.pro/# zithromax over the counter uk

  21. JamesLot说道:

    cost of generic clomid without dr prescription cheap clomid without a prescription where buy generic clomid prices

  22. BrainSaw说道:

    http://prednisonea.store/# 3000mg prednisone

  23. JamesLot说道:

    generic ivermectin stromectol pill for humans ivermectin 1

  24. DomenicDobby说道:

    order amoxicillin uk: amoxicillin no prescription – amoxicillin price canada

  25. JamesLot说道:

    prednisone ordering online apo prednisone prednisone 20mg online

  26. Josephtrink说道:

    https://amoxicillina.top/# where can i get amoxicillin

  27. BryanSturf说道:

    amoxicillin generic brand: can i buy amoxicillin over the counter – amoxicillin 500 mg tablet

  28. JamesLot说道:

    where to buy zithromax in canada zithromax canadian pharmacy zithromax 500 mg lowest price pharmacy online

  29. JamesLot说道:

    ivermectin virus stromectol tablets for humans ivermectin 80 mg

  30. Josephtrink说道:

    http://clomida.pro/# order generic clomid pill

  31. DomenicDobby说道:

    prednisone pharmacy: prednisone 30 – canada pharmacy prednisone

  32. Archierut说道:

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

  33. JeromedUb说道:

    doxycycline 200 mg doxycycline hyc doxycycline 100mg tablets

  34. JeromedUb说道:

    how to prevent hair loss while on tamoxifen tamoxifen dosage tamoxifen bone pain

  35. Williamzew说道:

    ordering diflucan generic: diflucan 125mg – diflucan tablet india

  36. JamesSew说道:

    Cytotec 200mcg price: Abortion pills online – order cytotec online

  37. JeromedUb说道:

    3 diflucan pills where can you get diflucan diflucan no prescription

  38. JeromedUb说道:

    buy doxycycline cheap buy doxycycline 100mg doxycycline 100mg dogs

  39. Archierut说道:

    https://misoprostol.top/# purchase cytotec

  40. JeromedUb说道:

    buy doxycycline online 270 tabs cheap doxycycline online doxycycline 100mg tablets

  41. JeromedUb说道:

    tamoxifen and osteoporosis nolvadex d tamoxifen medication

  42. Williamzew说道:

    order cytotec online: cytotec abortion pill – buy cytotec in usa

  43. JeromedUb说道:

    tamoxifen buy nolvadex steroids tamoxifen rash pictures

  44. JeromedUb说道:

    nolvadex pills does tamoxifen cause weight loss tamoxifen pill

发表回复

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