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

/ 8,999评论 / 42164阅读 / 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. RandallGuesE说道:

    ciprofloxacin over the counter: ciprofloxacin over the counter – cipro 500mg best prices

  2. WilliamRen说道:

    http://finasteride.store/# get cheap propecia

  3. RonaldSwobe说道:

    http://cytotec.club/# purchase cytotec

  4. RandallGuesE说道:

    cipro: cipro generic – cipro pharmacy

  5. Davidfrify说道:

    liquid tamoxifen generic tamoxifen tamoxifen endometriosis

  6. Marcelcrolf说道:

    https://indiaph24.store/# best india pharmacy

  7. Pedropaite说道:

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

  8. Michaelsew说道:

    http://indiaph24.store/# Online medicine home delivery

  9. Marcelcrolf说道:

    https://mexicoph24.life/# best online pharmacies in mexico

  10. StevenSen说道:

    mexico pharmacies prescription drugs: Mexican Pharmacy Online – pharmacies in mexico that ship to usa

  11. RickyAlage说道:

    top 10 online pharmacy in india indian pharmacy best india pharmacy

  12. Pedropaite说道:

    mexican pharmacy: cheapest mexico drugs – mexico drug stores pharmacies

  13. RickyAlage说道:

    mexican border pharmacies shipping to usa mexican rx online pharmacies in mexico that ship to usa

  14. Marcelcrolf说道:

    http://indiaph24.store/# online shopping pharmacy india

  15. Marcelcrolf说道:

    https://indiaph24.store/# mail order pharmacy india

  16. Pedropaite说道:

    п»їbest mexican online pharmacies: mexican pharmacy – buying prescription drugs in mexico online

  17. JustinTut说道:

    buy medicines online in india http://indiaph24.store/# п»їlegitimate online pharmacies india
    buy prescription drugs from india

  18. RickyAlage说道:

    best online pharmacy india Generic Medicine India to USA best india pharmacy

  19. Marcelcrolf说道:

    https://canadaph24.pro/# canadian pharmacy online

  20. RickyAlage说道:

    п»їbest mexican online pharmacies cheapest mexico drugs mexican pharmacy

  21. StevenSen说道:

    mexican rx online: mexican pharmaceuticals online – mexican drugstore online

  22. RickyAlage说道:

    canadian family pharmacy Licensed Canadian Pharmacy best mail order pharmacy canada

  23. RickyAlage说道:

    my canadian pharmacy reviews Certified Canadian Pharmacies canada pharmacy reviews

  24. Michaelsew说道:

    https://mexicoph24.life/# medicine in mexico pharmacies

  25. RickyAlage说道:

    india online pharmacy Cheapest online pharmacy pharmacy website india

  26. RickyAlage说道:

    top 10 pharmacies in india Cheapest online pharmacy Online medicine order

  27. StevenSen说道:

    mexican pharmaceuticals online: buying prescription drugs in mexico – medicine in mexico pharmacies

  28. RickyAlage说道:

    cheapest online pharmacy india best online pharmacy india indian pharmacies safe

  29. Michaelsew说道:

    http://canadaph24.pro/# online canadian pharmacy reviews

  30. RickyAlage说道:

    reliable canadian pharmacy Certified Canadian Pharmacies canadapharmacyonline com

  31. RickyAlage说道:

    india pharmacy indian pharmacies safe online shopping pharmacy india

  32. RickyAlage说道:

    mexico drug stores pharmacies Online Pharmacies in Mexico mexico pharmacy

  33. JustinTut说道:

    mail order pharmacy india https://indiaph24.store/# cheapest online pharmacy india
    indian pharmacy online

  34. Michaelsew说道:

    https://mexicoph24.life/# buying from online mexican pharmacy

  35. RickyAlage说道:

    buying prescription drugs in mexico online medicine in mexico pharmacies mexico drug stores pharmacies

  36. JustinTut说道:

    pharmacy website india https://indiaph24.store/# mail order pharmacy india
    top online pharmacy india

  37. RickyAlage说道:

    world pharmacy india Cheapest online pharmacy indian pharmacy paypal

  38. JustinTut说道:

    best online pharmacy india https://indiaph24.store/# world pharmacy india
    buy medicines online in india

  39. RickyAlage说道:

    best online canadian pharmacy Large Selection of Medications from Canada maple leaf pharmacy in canada

  40. StevenSen说道:

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

  41. Michaelsew说道:

    http://mexicoph24.life/# mexico pharmacies prescription drugs

  42. RickyAlage说道:

    indianpharmacy com buy medicines from India cheapest online pharmacy india

  43. JustinTut说道:

    top 10 pharmacies in india http://indiaph24.store/# best online pharmacy india
    indianpharmacy com

  44. RickyAlage说道:

    my canadian pharmacy rx Certified Canadian Pharmacies online canadian pharmacy review

  45. JustinTut说道:

    top 10 pharmacies in india https://indiaph24.store/# indian pharmacies safe
    buy prescription drugs from india

  46. RickyAlage说道:

    pharmacy canadian superstore Certified Canadian Pharmacies canada pharmacy world

  47. JustinTut说道:

    indian pharmacy https://indiaph24.store/# indian pharmacy paypal
    mail order pharmacy india

  48. Michaelsew说道:

    http://canadaph24.pro/# canadian pharmacy king

  49. StevenSen说道:

    canadian drug prices: legit canadian pharmacy – canadian pharmacy service

  50. RickyAlage说道:

    reliable canadian pharmacy Licensed Canadian Pharmacy canada online pharmacy

发表回复

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