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

/ 9,060评论 / 42332阅读 / 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. Stephenvew说道:

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

  2. Jamescix说道:

    lasix for sale: furosemide 40 mg – lasix 40mg

  3. Davidham说道:

    stromectol uk buy ivermectin humans ivermectin cream 5%

  4. Jamescix说道:

    ivermectin goodrx: buy ivermectin stromectol – ivermectin 400 mg brands

  5. Leonardlex说道:

    purchase lisinopril 40 mg: lisinopril 10 mg online – buying lisinopril in mexico

  6. Jamescix说道:

    prednisone cream rx: 50 mg prednisone canada pharmacy – prednisone where can i buy

  7. Jamescix说道:

    lasix 100 mg tablet: Buy Lasix No Prescription – lasix 40mg

  8. Stephenvew说道:

    https://buyprednisone.store/# price of prednisone tablets

  9. Davidham说道:

    how much is ivermectin ivermectin 5ml ivermectin virus

  10. Davidham说道:

    rx drug lisinopril lisinopril 10mg online lisinopril 5 mg tablet cost

  11. Jamescix说道:

    stromectol tablet 3 mg: ivermectin usa price – ivermectin 8000

  12. Stephenvew说道:

    http://stromectol.fun/# ivermectin 1%

  13. Leonardlex说道:

    ivermectin pills human: ivermectin cream uk – ivermectin lotion price

  14. Jamescix说道:

    amoxicillin without rx: amoxicillin 500mg buy online canada – amoxicillin 500mg capsule cost

  15. Peterzew说道:

    medicine in mexico pharmacies buying prescription drugs in mexico п»їbest mexican online pharmacies

  16. Peterzew说道:

    best online pharmacies in mexico mexican mail order pharmacies mexico drug stores pharmacies

  17. TravisKic说道:

    https://mexicanph.com/# mexican drugstore online
    mexico drug stores pharmacies

  18. Peterzew说道:

    п»їbest mexican online pharmacies mexican mail order pharmacies mexican mail order pharmacies

  19. JulioJeobE说道:

    pharmacies in mexico that ship to usa mexican rx online best online pharmacies in mexico

  20. Jerrypef说道:

    medication from mexico pharmacy medicine in mexico pharmacies buying prescription drugs in mexico

  21. TravisKic说道:

    http://mexicanph.shop/# reputable mexican pharmacies online
    buying prescription drugs in mexico

  22. Peterzew说道:

    mexico pharmacies prescription drugs mexico pharmacies prescription drugs mexico drug stores pharmacies

  23. Jerrypef说道:

    mexico drug stores pharmacies mexican pharmaceuticals online mexican drugstore online

  24. Peterzew说道:

    medication from mexico pharmacy mexico drug stores pharmacies mexico pharmacy

  25. Peterzew说道:

    mexican online pharmacies prescription drugs buying from online mexican pharmacy mexican drugstore online

  26. JulioJeobE说道:

    mexican drugstore online buying from online mexican pharmacy mexican mail order pharmacies

  27. Jerrypef说道:

    reputable mexican pharmacies online buying prescription drugs in mexico medicine in mexico pharmacies

  28. Peterzew说道:

    buying prescription drugs in mexico mexico drug stores pharmacies mexico pharmacies prescription drugs

  29. Peterzew说道:

    medication from mexico pharmacy mexican border pharmacies shipping to usa п»їbest mexican online pharmacies

  30. TravisKic说道:

    https://mexicanph.shop/# mexico drug stores pharmacies
    п»їbest mexican online pharmacies

  31. Peterzew说道:

    medication from mexico pharmacy mexico drug stores pharmacies mexican border pharmacies shipping to usa

  32. Jerrypef说道:

    best online pharmacies in mexico reputable mexican pharmacies online best online pharmacies in mexico

  33. Jerrypef说道:

    medication from mexico pharmacy pharmacies in mexico that ship to usa mexico pharmacy

  34. Peterzew说道:

    pharmacies in mexico that ship to usa mexico drug stores pharmacies buying prescription drugs in mexico

  35. JulioJeobE说道:

    purple pharmacy mexico price list buying prescription drugs in mexico online mexico drug stores pharmacies

  36. Peterzew说道:

    mexico drug stores pharmacies mexico pharmacies prescription drugs mexican rx online

  37. TravisKic说道:

    https://mexicanph.shop/# mexican drugstore online
    medication from mexico pharmacy

  38. Jerrypef说道:

    medication from mexico pharmacy mexico drug stores pharmacies mexican pharmaceuticals online

  39. Peterzew说道:

    reputable mexican pharmacies online buying prescription drugs in mexico online mexico pharmacies prescription drugs

  40. JulioJeobE说道:

    mexican rx online mexican border pharmacies shipping to usa mexican drugstore online

  41. Peterzew说道:

    mexican mail order pharmacies mexican pharmaceuticals online mexican online pharmacies prescription drugs

  42. Jerrypef说道:

    medication from mexico pharmacy best online pharmacies in mexico mexico drug stores pharmacies

  43. Jerrypef说道:

    mexico drug stores pharmacies mexican drugstore online mexico pharmacies prescription drugs

  44. Peterzew说道:

    mexico drug stores pharmacies mexican mail order pharmacies best online pharmacies in mexico

  45. TravisKic说道:

    https://mexicanph.shop/# buying prescription drugs in mexico
    best online pharmacies in mexico

  46. Peterzew说道:

    mexican rx online best online pharmacies in mexico buying from online mexican pharmacy

  47. Jerrypef说道:

    pharmacies in mexico that ship to usa mexico pharmacies prescription drugs mexican mail order pharmacies

  48. Jerrypef说道:

    mexico pharmacies prescription drugs best online pharmacies in mexico mexican rx online

  49. Peterzew说道:

    medication from mexico pharmacy reputable mexican pharmacies online mexican online pharmacies prescription drugs

  50. JulioJeobE说道:

    п»їbest mexican online pharmacies mexican border pharmacies shipping to usa purple pharmacy mexico price list

发表回复

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