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

/ 9,023评论 / 42218阅读 / 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. DonaldtAg说道:

    online pharmacies no prescription usa: online no prescription pharmacy – online canadian pharmacy no prescription

  2. Williamfug说道:

    canada drugs coupon code: cheapest pharmacy – canadian pharmacy no prescription needed

  3. Felipelam说道:

    http://pharmnoprescription.icu/# online doctor prescription canada

  4. Williamfug说道:

    canadian pharmacy no prescription needed: pharm world – legal online pharmacy coupon code

  5. Jeromeviaph说道:

    http://pharmindia.online/# world pharmacy india

  6. DonaldtAg说道:

    canadianpharmacyworld: northwest pharmacy canada – canada pharmacy online legit

  7. DavidTaK说道:

    pharmacy canadian rate canadian pharmacies buy canadian drugs

  8. Felipelam说道:

    http://pharmworld.store/# online canadian pharmacy coupon

  9. Jeromeviaph说道:

    https://pharmindia.online/# reputable indian online pharmacy

  10. Donaldkenty说道:

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

  11. Felipelam说道:

    https://pharmnoprescription.icu/# buying prescription drugs in canada

  12. DavidTaK说道:

    rx pharmacy coupons pharm world store foreign pharmacy no prescription

  13. DavidTaK说道:

    canadian drugs pharmacy canadian pharmacy store legitimate canadian pharmacy

  14. Williamfug说道:

    mexican pharmacy: medication from mexico pharmacy – mexican drugstore online

  15. Williamfug说道:

    top 10 online pharmacy in india: india pharmacy – pharmacy website india

  16. Felipelam说道:

    https://pharmcanada.shop/# canadian world pharmacy

  17. DonaldtAg说道:

    mexican mail order pharmacies: mexican rx online – medication from mexico pharmacy

  18. DavidTaK说道:

    buy medicines online in india indian pharmacies safe online shopping pharmacy india

  19. Williamfug说道:

    pharmacy online no prescription: meds online no prescription – prescription online canada

  20. Charlesvox说道:

    https://viagras.online/# Buy Viagra online cheap

  21. Jamesexite说道:

    buy cenforce: cheapest cenforce – Cenforce 150 mg online

  22. Elmersoalf说道:

    Generic Cialis price Cialis 20mg price in USA Generic Tadalafil 20mg price

  23. DavidBiolo说道:

    http://cialist.pro/# buy cialis pill

  24. Jamesexite说道:

    Generic Tadalafil 20mg price: Generic Tadalafil 20mg price – Generic Cialis price

  25. Charlesvox说道:

    https://levitrav.store/# Cheap Levitra online

  26. Elmersoalf说道:

    buy cenforce order cenforce Cenforce 150 mg online

  27. Elmersoalf说道:

    п»їkamagra kamagra oral jelly Kamagra Oral Jelly

  28. Charlesvox说道:

    http://kamagra.win/# Kamagra 100mg price

  29. Georgefrege说道:

    Kamagra tablets: kamagra oral jelly – Kamagra Oral Jelly

  30. Jamesexite说道:

    Buy generic 100mg Viagra online: Buy generic 100mg Viagra online – Viagra online price

  31. DavidBiolo说道:

    http://kamagra.win/# buy Kamagra

  32. Charlesvox说道:

    http://kamagra.win/# Kamagra Oral Jelly

  33. Elmersoalf说道:

    Cialis 20mg price in USA cialist.pro Buy Tadalafil 5mg

  34. Tylerreunk说道:

    https://cenforce.pro/# Purchase Cenforce Online

  35. Jamesexite说道:

    cenforce.pro: Purchase Cenforce Online – cenforce.pro

  36. Jamesexite说道:

    super kamagra: buy kamagra online – sildenafil oral jelly 100mg kamagra

  37. Charlesvox说道:

    http://cenforce.pro/# Cenforce 100mg tablets for sale

  38. DavidBiolo说道:

    http://kamagra.win/# Kamagra 100mg

  39. Georgefrege说道:

    Kamagra 100mg price: kamagra pills – п»їkamagra

  40. Elmersoalf说道:

    Buy Cenforce 100mg Online cenforce for sale Buy Cenforce 100mg Online

  41. Elmersoalf说道:

    cheapest cenforce Buy Cenforce 100mg Online Purchase Cenforce Online

  42. Charlesvox说道:

    http://viagras.online/# over the counter sildenafil

  43. Jamesexite说道:

    Buy Tadalafil 5mg: Generic Tadalafil 20mg price – Cheap Cialis

  44. Elmersoalf说道:

    Buy Tadalafil 10mg Generic Tadalafil 20mg price п»їcialis generic

  45. Georgefrege说道:

    buy Viagra online: Cheapest place to buy Viagra – best price for viagra 100mg

  46. Charlesvox说道:

    https://cialist.pro/# Buy Tadalafil 10mg

  47. Jamesexite说道:

    Tadalafil Tablet: Generic Cialis without a doctor prescription – Buy Tadalafil 10mg

  48. Elmersoalf说道:

    Buy Vardenafil online Buy generic Levitra online Generic Levitra 20mg

  49. Elmersoalf说道:

    Cialis 20mg price in USA buy cialis online Cialis without a doctor prescription

  50. Jamesexite说道:

    viagra canada: Cheap Viagra 100mg – buy Viagra over the counter

发表回复

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