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

/ 9,036评论 / 42243阅读 / 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. Richardfrota说道:

    neurontin price in india: neurontin 100 mg caps – neurontin 600 mg capsule

  2. MarvinMek说道:

    cost of amoxicillin amoxicillin 500mg capsule cost where to buy amoxicillin over the counter

  3. HenryIsona说道:

    generic zithromax online paypal: zithromax 500 without prescription – zithromax prescription

  4. Billyeroge说道:

    http://gabapentinneurontin.pro/# neurontin 200 mg tablets

  5. Billyeroge说道:

    https://doxycyclinea.online/# where to purchase doxycycline

  6. MarvinMek说道:

    amoxicillin cost australia amoxicillin 500 mg for sale can you buy amoxicillin uk

  7. MarvinMek说道:

    prednisone 40mg online prednisone 5mg prednisone for dogs

  8. HenryIsona说道:

    buy prednisone from canada: prednisone online india – prednisone over the counter uk

  9. Billyeroge说道:

    http://prednisoned.online/# buying prednisone mexico

  10. HenryIsona说道:

    generic amoxicillin 500mg: amoxicillin 500mg price canada – over the counter amoxicillin canada

  11. MarvinMek说道:

    buy doxycycline online uk cheap doxycycline online cheap doxycycline online

  12. HenryIsona说道:

    buy cheap doxycycline online: doxycycline 50 mg – order doxycycline 100mg without prescription

  13. CharlesGib说道:

    medicine neurontin capsules: neurontin 300 mg pill – generic neurontin cost

  14. Billyeroge说道:

    http://gabapentinneurontin.pro/# ordering neurontin online

  15. Richardfrota说道:

    neurontin 30 mg: neurontin cost – prescription price for neurontin

  16. MarvinMek说道:

    zithromax zithromax for sale us zithromax for sale cheap

  17. MarvinMek说道:

    zithromax 500 mg zithromax 500 price zithromax 500mg price

  18. HenryIsona说道:

    amoxicillin buy no prescription: amoxicillin 500 mg without prescription – where to get amoxicillin over the counter

  19. Billyeroge说道:

    https://amoxila.pro/# amoxicillin 500mg buy online uk

  20. HenryIsona说道:

    drug neurontin: neurontin 300 mg price in india – neurontin

  21. Richardfrota说道:

    buy doxycycline 100mg: doxycycline 500mg – doxycycline 150 mg

  22. MarvinMek说道:

    buy neurontin 100 mg canada buy gabapentin online neurontin 800 pill

  23. CharlesGib说道:

    doxycycline 50mg: doxycycline 100mg tablets – doxycycline 100mg

  24. CharlesGib说道:

    buy doxycycline: order doxycycline – doxycycline hyc 100mg

  25. Richardfrota说道:

    zithromax online usa no prescription: zithromax 250 mg australia – zithromax cost australia

  26. HenryIsona说道:

    where to buy amoxicillin over the counter: amoxicillin 500 mg without a prescription – amoxicillin order online no prescription

  27. HenryIsona说道:

    amoxicillin capsules 250mg: amoxicillin 500mg buy online canada – amoxicillin 500 mg purchase without prescription

  28. HenryIsona说道:

    neurontin capsules 600mg: brand neurontin 100 mg canada – prescription price for neurontin

  29. CharlesGib说道:

    buy cheap doxycycline: 200 mg doxycycline – where to purchase doxycycline

  30. Richardfrota说道:

    doxycycline without prescription: cheap doxycycline online – doxycycline order online

  31. HenryIsona说道:

    how to order doxycycline: doxycycline monohydrate – online doxycycline

  32. Billyeroge说道:

    https://prednisoned.online/# prednisone 20mg tab price

  33. HenryIsona说道:

    buy prednisone 10 mg: buy prednisone 10 mg – prednisone 5 mg tablet cost

  34. Richardfrota说道:

    amoxicillin 1000 mg capsule: amoxicillin price canada – amoxicillin online pharmacy

  35. CharlesGib说道:

    amoxicillin 500 coupon: buy amoxicillin online with paypal – where to buy amoxicillin over the counter

  36. Billyeroge说道:

    https://amoxila.pro/# amoxicillin 500mg tablets price in india

  37. MarvinMek说道:

    where can i buy amoxicillin over the counter buy amoxicillin 500mg capsules uk buy amoxicillin online no prescription

  38. MarvinMek说道:

    prednisone canada pharmacy prednisone 40mg prednisone 300mg

  39. HenryIsona说道:

    average cost of prednisone: prednisone 5 mg – prednisone cost 10mg

  40. CharlesGib说道:

    zithromax generic cost: zithromax for sale usa – zithromax over the counter uk

  41. Billyeroge说道:

    https://doxycyclinea.online/# cheap doxycycline online

  42. Richardfrota说道:

    neurontin 100mg: how much is generic neurontin – neurontin 200 mg tablets

  43. MarvinMek说道:

    zithromax without prescription buy zithromax 1000mg online zithromax cost

  44. HenryIsona说道:

    600 mg neurontin tablets: gabapentin 600 mg – neurontin tablets no script

  45. Billyeroge说道:

    https://doxycyclinea.online/# purchase doxycycline online

  46. HenryIsona说道:

    doxycycline hyc: online doxycycline – doxycycline prices

  47. MarvinMek说道:

    zithromax capsules australia buy zithromax without presc can i buy zithromax online

  48. Billyeroge说道:

    http://amoxila.pro/# purchase amoxicillin online without prescription

  49. HenryIsona说道:

    prednisone 5 mg: prednisone 2 5 mg – cost of prednisone 10mg tablets

发表回复

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