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

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

    buy generic clomid prices: where can i get cheap clomid without a prescription – buy generic clomid without insurance

  2. Williamaninc说道:

    compare prednisone prices: can i take prednisone at night instead of morning – prednisone pak

  3. Williamaninc说道:

    over the counter prednisone pills: can you take ibuprofen with prednisone – purchase prednisone no prescription

  4. BrianAcile说道:

    https://clomidst.pro/# get cheap clomid without insurance

  5. BrianAcile说道:

    http://amoxilst.pro/# amoxicillin 500 mg for sale

  6. Irwinsusia说道:

    amoxil generic: purchase amoxicillin online without prescription – amoxicillin 500mg capsule buy online

  7. AnthonyPhave说道:

    prednisone 50 generic prednisone pills prednisone online australia

  8. Waynenit说道:

    order amoxicillin online: where can i buy amoxicillin online – amoxicillin generic

  9. Williamaninc说道:

    20 mg of prednisone: 20 mg prednisone – order prednisone 10mg

  10. BrianAcile说道:

    https://clomidst.pro/# where buy cheap clomid without rx

  11. Williamaninc说道:

    buy prednisone nz: what is prednisone used for in adults – purchase prednisone from india

  12. BrianAcile说道:

    http://clomidst.pro/# can you get clomid without insurance

  13. AnthonyPhave说道:

    amoxicillin 500mg without prescription amoxil generic cost of amoxicillin prescription

  14. BrianAcile说道:

    http://clomidst.pro/# can you get clomid no prescription

  15. Irwinsusia说道:

    prednisone 50 mg for sale: buy prednisone without prescription – how can i get prednisone

  16. Williamaninc说道:

    can you buy generic clomid no prescription: clomid ovulation calculator – can i purchase clomid without rx

  17. Waynenit说道:

    can i buy amoxicillin over the counter in australia: buy amoxicillin online cheap – where to buy amoxicillin 500mg without prescription

  18. BrianAcile说道:

    http://prednisonest.pro/# purchase prednisone canada

  19. Williamaninc说道:

    order amoxicillin 500mg: how long does it take for amoxicillin to work – buy amoxicillin online no prescription

  20. BrianAcile说道:

    https://prednisonest.pro/# buy prednisone 10mg

  21. AnthonyPhave说道:

    amoxicillin 500 mg tablet where to buy amoxicillin cost of amoxicillin

  22. Waynenit说道:

    amoxicillin 800 mg price: amoxicillin 875 – buy amoxicillin online uk

  23. BrianAcile说道:

    http://amoxilst.pro/# amoxicillin 500mg price canada

  24. Williamaninc说道:

    how to buy clomid price: how can i get generic clomid without insurance – can i order generic clomid pill

  25. Irwinsusia说道:

    amoxicillin 500mg price in canada: canadian pharmacy amoxicillin – amoxicillin 500 mg tablet

  26. Williamaninc说道:

    prednisone 1 mg tablet: prednisone 80 mg daily – prednisone 40mg

  27. BrianAcile说道:

    http://clomidst.pro/# cost generic clomid without a prescription

  28. AnthonyPhave说道:

    amoxicillin buy no prescription order amoxicillin 500mg amoxicillin 500 mg tablet

  29. BrianAcile说道:

    http://clomidst.pro/# buy generic clomid

  30. Waynenit说道:

    prednisone drug costs: does prednisone cause weight gain – how to buy prednisone

  31. Williamaninc说道:

    amoxicillin without prescription: amoxicillin uses – over the counter amoxicillin

  32. BrianAcile说道:

    http://prednisonest.pro/# prednisone 20mg prescription cost

  33. Irwinsusia说道:

    how to buy clomid price: clomid 50mg price – cost of generic clomid without dr prescription

  34. Waynenit说道:

    prednisone pills cost: prednisone moon face – 40 mg prednisone pill

  35. AnthonyPhave说道:

    prednisone otc uk prednisone 10 tablet generic over the counter prednisone

  36. Robertneede说道:

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

  37. MarcusPielp说道:

    mexican rx online Mexico pharmacy online п»їbest mexican online pharmacies mexicanpharm.shop

  38. PhilipDob说道:

    canadian pharmacy antibiotics: Canada pharmacy online – drugs from canada canadianpharm.store

  39. PhilipDob说道:

    purple pharmacy mexico price list: mexican pharmaceuticals online – mexico pharmacy mexicanpharm.shop

  40. Richardevarp说道:

    canada cloud pharmacy: Best Canadian online pharmacy – canadian pharmacy near me canadianpharm.store

  41. Robertneede说道:

    http://canadianpharmlk.shop/# vipps approved canadian online pharmacy canadianpharm.store

  42. Robertneede说道:

    https://indianpharm24.com/# indian pharmacies safe indianpharm.store

  43. MarcusPielp说道:

    indian pharmacies safe online pharmacy usa indian pharmacy indianpharm.store

  44. Billyswemo说道:

    http://canadianpharmlk.com/# cheap canadian pharmacy canadianpharm.store

  45. PhilipDob说道:

    mexican drugstore online: mexican pharmacy – п»їbest mexican online pharmacies mexicanpharm.shop

  46. PhilipDob说道:

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

  47. Robertneede说道:

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

  48. Richardevarp说道:

    Online medicine home delivery: indian pharmacy – top 10 pharmacies in india indianpharm.store

  49. Robertneede说道:

    https://mexicanpharm24.com/# medication from mexico pharmacy mexicanpharm.shop

  50. PhilipDob说道:

    mexico pharmacy: Medicines Mexico – medication from mexico pharmacy mexicanpharm.shop

发表回复

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