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

/ 9,052评论 / 42309阅读 / 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. BryanGob说道:

    indian pharmacy Online medicine order п»їlegitimate online pharmacies india

  2. BryanGob说道:

    indianpharmacy com reputable indian pharmacies online shopping pharmacy india

  3. Ronaldrok说道:

    https://indianph.xyz/# top 10 pharmacies in india

  4. Arthurfum说道:

    indian pharmacy paypal buy medicines online in india india pharmacy

  5. BryanGob说道:

    india pharmacy mail order top 10 pharmacies in india mail order pharmacy india

  6. BryanGob说道:

    best india pharmacy indian pharmacy paypal indianpharmacy com

  7. Ronaldrok说道:

    https://indianph.com/# best india pharmacy

  8. Kennethvance说道:

    top 10 online pharmacy in india online pharmacy india india pharmacy mail order

  9. BryanGob说道:

    india online pharmacy top online pharmacy india buy prescription drugs from india

  10. Kennethvance说道:

    indian pharmacy paypal online pharmacy india reputable indian pharmacies

  11. Arthurfum说道:

    world pharmacy india п»їlegitimate online pharmacies india buy medicines online in india

  12. BryanGob说道:

    online pharmacy india best online pharmacy india world pharmacy india

  13. Stephenvew说道:

    https://buyprednisone.store/# purchase prednisone

  14. Jamescix说道:

    stromectol tablets uk: stromectol uk buy – ivermectin 200 mcg

  15. Jamescix说道:

    generic over the counter prednisone: prednisone 3 tablets daily – no prescription prednisone canadian pharmacy

  16. Davidham说道:

    lisinopril 20 25 mg where to buy lisinopril without prescription zestoretic 20 12.5

  17. Davidham说道:

    buy lisinopril prinivil lisinopril lisinopril pill

  18. Jamescix说道:

    lisinopril without prescription: lisinopril brand – zestril 20 mg

  19. Jamescix说道:

    buy oral ivermectin: ivermectin medication – ivermectin 12 mg

  20. Jamescix说道:

    generic for amoxicillin: amoxicillin 1000 mg capsule – buy cheap amoxicillin

  21. Davidham说道:

    lasix tablet lasix uses lasix 20 mg

  22. Jamescix说道:

    buy prednisone 50 mg: 20 mg prednisone tablet – prednisone brand name india

  23. Davidham说道:

    buy lisinopril 20 mg online uk price of zestril zestril 20 mg tablet

  24. Leonardlex说道:

    pharmacy cost of prednisone: can i purchase prednisone without a prescription – 50 mg prednisone from canada

  25. Jamescix说道:

    zestril 20 mg price canadian pharmacy: lisinopril 7.5 mg – lisinopril 40 mg coupon

  26. Stephenvew说道:

    https://buyprednisone.store/# prednisone online sale

  27. Jamescix说道:

    zestoretic tabs: lisinopril 1 mg – lisinopril generic price

  28. Jamescix说道:

    buy lasix online: Buy Lasix No Prescription – lasix online

  29. Davidham说道:

    lisinopril 40 mg without prescription zestril 2.5 mg price of lisinopril 20 mg

  30. Jamescix说道:

    ivermectin 2ml: ivermectin 3mg dosage – ivermectin 1%

  31. Leonardlex说道:

    buy furosemide online: Buy Lasix – lasix tablet

  32. Jamescix说道:

    prednisone 20 mg tablet price: 1 mg prednisone cost – prednisone pack

  33. Davidham说道:

    prednisone 5 mg tablet without a prescription can you buy prednisone over the counter in usa compare prednisone prices

  34. Jamescix说道:

    amoxicillin pills 500 mg: buy amoxicillin canada – amoxicillin 800 mg price

  35. Stephenvew说道:

    http://amoxil.cheap/# amoxicillin capsule 500mg price

  36. Davidham说道:

    furosemide 40mg lasix generic furosemide 40 mg

  37. Jamescix说道:

    prednisone buying: buy prednisone 40 mg – 10 mg prednisone tablets

  38. Leonardlex说道:

    ivermectin lotion price: purchase ivermectin – where to buy stromectol

  39. Jamescix说道:

    ivermectin 6 tablet: ivermectin pills human – stromectol price us

  40. Stephenvew说道:

    https://buyprednisone.store/# 5 mg prednisone daily

  41. Davidham说道:

    buy furosemide online Buy Lasix No Prescription lasix generic name

  42. Jamescix说道:

    prinivil 10 mg: generic lisinopril 3973 – generic for zestril

  43. Jamescix说道:

    buy amoxicillin 500mg: amoxicillin without rx – amoxicillin 500mg capsules antibiotic

  44. Jamescix说道:

    generic amoxicillin online: can you purchase amoxicillin online – amoxicillin where to get

  45. Leonardlex说道:

    buy amoxicillin 500mg capsules uk: amoxicillin 500 mg tablet price – buy amoxicillin 500mg canada

  46. childrens sex说道:

    sexx tthighereduhryyy.bf935ok7qAw

  47. Davidham说道:

    prednisone best prices buy prednisone online no prescription where to buy prednisone without prescription

  48. Jamescix说道:

    cost of stromectol: minocin 50 mg for scabies – buy stromectol online uk

  49. Davidham说道:

    azithromycin amoxicillin price of amoxicillin without insurance where to buy amoxicillin over the counter

  50. Stephenvew说道:

    https://amoxil.cheap/# amoxicillin 500mg price canada

发表回复

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