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

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

    https://gabapentinneurontin.pro/# how much is generic neurontin

  2. HenryIsona说道:

    generic doxycycline: doxycycline generic – buy doxycycline for dogs

  3. MarvinMek说道:

    buy brand neurontin neurontin 200 mg neurontin 200

  4. HenryIsona说道:

    20 mg prednisone: prednisone buy online nz – how can i get prednisone

  5. Billyeroge说道:

    https://doxycyclinea.online/# doxycycline 500mg

  6. Richardfrota说道:

    zithromax 250: zithromax z-pak – zithromax price canada

  7. CharlesGib说道:

    amoxicillin capsule 500mg price: amoxicillin script – where can i buy amoxicillin over the counter

  8. MarvinMek说道:

    buy prednisone tablets uk order prednisone 100g online without prescription prednisone pack

  9. MarvinMek说道:

    buy zithromax online with mastercard zithromax 250 price zithromax cost canada

  10. HenryIsona说道:

    where to get amoxicillin over the counter: amoxacillian without a percription – amoxicillin generic brand

  11. CharlesGib说道:

    buying neurontin without a prescription: buying neurontin online – neurontin cost in singapore

  12. Billyeroge说道:

    http://zithromaxa.store/# buy zithromax online with mastercard

  13. Richardfrota说道:

    where can i buy amoxicillin over the counter: amoxil generic – amoxicillin 500mg for sale uk

  14. MarvinMek说道:

    order zithromax over the counter zithromax 1000 mg online zithromax cost australia

  15. Billyeroge说道:

    https://zithromaxa.store/# can you buy zithromax over the counter

  16. Billyeroge说道:

    https://gabapentinneurontin.pro/# neurontin tablets uk

  17. MarvinMek说道:

    purchase amoxicillin online amoxicillin without prescription amoxicillin 500 tablet

  18. MarvinMek说道:

    amoxicillin 500 mg tablet prescription for amoxicillin amoxicillin 250 mg

  19. HenryIsona说道:

    buy prednisone 10mg online: prednisone online sale – prednisone 0.5 mg

  20. HenryIsona说道:

    neurontin oral: neurontin 400 mg capsules – buy gabapentin

  21. CharlesGib说道:

    buy amoxicillin 500mg online: generic amoxil 500 mg – amoxicillin 500mg capsule

  22. HenryIsona说道:

    doxycycline generic: vibramycin 100 mg – doxycycline hyc

  23. Richardfrota说道:

    where can i get doxycycline: doxycycline mono – buy doxycycline online without prescription

  24. MarvinMek说道:

    order doxycycline online buy doxycycline for dogs doxycycline hyclate 100 mg cap

  25. Billyeroge说道:

    http://zithromaxa.store/# zithromax without prescription

  26. Billyeroge说道:

    http://zithromaxa.store/# buy cheap zithromax online

  27. MarvinMek说道:

    amoxicillin 500 mg for sale amoxicillin pharmacy price amoxicillin price canada

  28. MarvinMek说道:

    where to buy amoxicillin pharmacy amoxicillin tablet 500mg amoxicillin brand name

  29. HenryIsona说道:

    price of amoxicillin without insurance: how to buy amoxycillin – rexall pharmacy amoxicillin 500mg

  30. Richardfrota说道:

    amoxicillin script: how much is amoxicillin – amoxicillin discount coupon

  31. HenryIsona说道:

    amoxicillin 750 mg price: where can you get amoxicillin – can i buy amoxicillin over the counter in australia

  32. Billyeroge说道:

    http://amoxila.pro/# buy amoxicillin canada

  33. CharlesGib说道:

    prednisone in india: how to get prednisone tablets – price for 15 prednisone

  34. HenryIsona说道:

    zithromax for sale 500 mg: buy cheap zithromax online – can you buy zithromax over the counter in canada

  35. MarvinMek说道:

    buy amoxicillin 500mg capsules uk buy amoxicillin over the counter uk amoxicillin pharmacy price

  36. Billyeroge说道:

    http://zithromaxa.store/# zithromax online no prescription

  37. CharlesGib说道:

    prednisone medication: prednisone 2.5 mg tab – prednisone 40 mg rx

  38. MarvinMek说道:

    zithromax antibiotic how to get zithromax zithromax 500 mg lowest price online

  39. Richardfrota说道:

    order doxycycline: doxycycline generic – doxy 200

  40. MarvinMek说道:

    prednisone in india buy prednisone without prescription prednisone 250 mg

  41. HenryIsona说道:

    neurontin 100 mg capsule: generic neurontin – neurontin 100 mg cost

  42. HenryIsona说道:

    buy doxycycline 100mg: buy doxycycline 100mg – vibramycin 100 mg

  43. Billyeroge说道:

    https://gabapentinneurontin.pro/# neurontin 100mg tablets

  44. HenryIsona说道:

    cost of prednisone 10mg tablets: prednisone online india – prednisone 10 mg tablet

  45. MarvinMek说道:

    can you buy zithromax online can you buy zithromax over the counter in mexico buy zithromax no prescription

  46. Billyeroge说道:

    https://zithromaxa.store/# zithromax 250mg

  47. Billyeroge说道:

    https://zithromaxa.store/# zithromax coupon

发表回复

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