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

/ 9,037评论 / 42263阅读 / 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. Robertneede说道:

    http://mexicanpharm24.com/# mexico pharmacies prescription drugs mexicanpharm.shop

  2. PhilipDob说道:

    buy prescription drugs from india: Pharmacies in India that ship to USA – india pharmacy mail order indianpharm.store

  3. MarcusPielp说道:

    reliable canadian pharmacy Certified Canadian pharmacies canadianpharmacyworld com canadianpharm.store

  4. Billyswemo说道:

    https://canadianpharmlk.com/# precription drugs from canada canadianpharm.store

  5. Robertneede说道:

    https://mexicanpharm24.shop/# mexican drugstore online mexicanpharm.shop

  6. Richardevarp说道:

    pharmacies in mexico that ship to usa: order online from a Mexican pharmacy – mexican online pharmacies prescription drugs mexicanpharm.shop

  7. Robertneede说道:

    http://indianpharm24.com/# best india pharmacy indianpharm.store

  8. PhilipDob说道:

    mexican rx online: Mexico pharmacy price list – medication from mexico pharmacy mexicanpharm.shop

  9. MarcusPielp说道:

    canada pharmacy online Cheapest drug prices Canada canadian compounding pharmacy canadianpharm.store

  10. PhilipDob说道:

    pharmacies in mexico that ship to usa: Mexico pharmacy price list – reputable mexican pharmacies online mexicanpharm.shop

  11. Robertneede说道:

    http://canadianpharmlk.com/# best canadian pharmacy online canadianpharm.store

  12. Robertneede说道:

    https://mexicanpharm24.shop/# mexico pharmacy mexicanpharm.shop

  13. Billyswemo说道:

    https://indianpharm24.com/# indian pharmacy paypal indianpharm.store

  14. Richardevarp说道:

    mexico drug stores pharmacies: order online from a Mexican pharmacy – reputable mexican pharmacies online mexicanpharm.shop

  15. PhilipDob说道:

    canadian pharmacy 365: Best Canadian online pharmacy – best canadian pharmacy canadianpharm.store

  16. PhilipDob说道:

    canada rx pharmacy: Canada pharmacy online – safe canadian pharmacy canadianpharm.store

  17. Robertneede说道:

    https://mexicanpharm24.shop/# mexican border pharmacies shipping to usa mexicanpharm.shop

  18. MarcusPielp说道:

    pharmacy website india top 10 online pharmacy in india indian pharmacy online indianpharm.store

  19. Robertneede说道:

    https://canadianpharmlk.shop/# buy prescription drugs from canada cheap canadianpharm.store

  20. Richardevarp说道:

    top 10 pharmacies in india: online pharmacy usa – india pharmacy indianpharm.store

  21. Robertneede说道:

    https://canadianpharmlk.com/# pet meds without vet prescription canada canadianpharm.store

  22. PhilipDob说道:

    mexican pharmaceuticals online: mexico drug stores pharmacies – pharmacies in mexico that ship to usa mexicanpharm.shop

  23. Billyswemo说道:

    http://indianpharm24.com/# world pharmacy india indianpharm.store

  24. PhilipDob说道:

    mexican drugstore online: Medicines Mexico – pharmacies in mexico that ship to usa mexicanpharm.shop

  25. MarcusPielp说道:

    canadian pharmacy ratings Canada pharmacy online buy prescription drugs from canada cheap canadianpharm.store

  26. Robertneede说道:

    https://indianpharm24.shop/# indianpharmacy com indianpharm.store

  27. PhilipDob说道:

    top 10 online pharmacy in india: online pharmacy in india – top 10 pharmacies in india indianpharm.store

  28. PhilipDob说道:

    mexican pharmacy: order online from a Mexican pharmacy – medication from mexico pharmacy mexicanpharm.shop

  29. PhilipDob说道:

    pharmacies in mexico that ship to usa: Mexico pharmacy online – п»їbest mexican online pharmacies mexicanpharm.shop

  30. PhilipDob说道:

    canadian discount pharmacy: canadian pharmacy – best canadian pharmacy canadianpharm.store

  31. Billyswemo说道:

    https://canadianpharmlk.com/# 77 canadian pharmacy canadianpharm.store

  32. MarcusPielp说道:

    world pharmacy india online pharmacy usa mail order pharmacy india indianpharm.store

  33. Richardevarp说道:

    canadian pharmacy tampa: Canada pharmacy online – canadian pharmacy world reviews canadianpharm.store

  34. Julioher说道:

    order zithromax over the counter: zithromax images zithromax 500 mg lowest price online

  35. Julioher说道:

    zithromax over the counter: zithromax 500 mg lowest price pharmacy online – zithromax over the counter

  36. Howardgredo说道:

    aviator oficial pin up: pin up bet – pin-up casino entrar

  37. Julioher说道:

    zithromax 500 price: buy generic zithromax online – generic zithromax online paypal

  38. Briansuist说道:

    http://pinupcassino.pro/# pin-up casino login

  39. Julioher说道:

    buy zithromax 500mg online – https://azithromycin.pro/zithromax-indications.html zithromax buy

  40. Howardgredo说道:

    aviator game: aviator jogar – pin up aviator

  41. Julioher说道:

    zithromax buy online: is azithromycin the same as zithromax buy zithromax online cheap

  42. ThomasNot说道:

    aviator bet malawi login: aviator bet malawi – aviator bet

  43. Howardgredo说道:

    aviator game: estrela bet aviator – aviator pin up

  44. ThomasNot说道:

    aviator betting game: aviator bet malawi – aviator game

  45. ThomasNot说道:

    aviator betano: aviator game – aviator pin up

  46. download full hd porn movies ggjinnysflogg.Cm1TzNrkOyK

  47. hd potrn说道:

    hd porn 4k download ggjennifegg.LvQFUUv62Zy

  48. Howardgredo说道:

    ganhar dinheiro jogando: aplicativo de aposta – melhor jogo de aposta para ganhar dinheiro

发表回复

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