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

/ 9,020评论 / 42210阅读 / 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. Charlesvox说道:

    https://viagras.online/# Viagra tablet online

  2. DavidBiolo说道:

    http://cenforce.pro/# order cenforce

  3. Charlesvox说道:

    http://levitrav.store/# Vardenafil online prescription

  4. Elmersoalf说道:

    buy cialis pill buy cialis overseas Buy Tadalafil 10mg

  5. Jamesexite说道:

    best price for viagra 100mg: Buy generic 100mg Viagra online – buy viagra here

  6. Jamesexite说道:

    Cialis without a doctor prescription: Cialis 20mg price in USA – cialis generic

  7. Elmersoalf说道:

    Levitra online USA fast Vardenafil online prescription Levitra online USA fast

  8. Elmersoalf说道:

    Cheap generic Viagra online Cheapest place to buy Viagra Viagra tablet online

  9. Charlesvox说道:

    http://levitrav.store/# Vardenafil price

  10. Jamesexite说道:

    Buy Vardenafil 20mg online: Levitra 20mg price – Buy Vardenafil 20mg

  11. Georgefrege说道:

    Cheap Cialis: buy cialis online – Cialis over the counter

  12. Charlesvox说道:

    https://levitrav.store/# Vardenafil buy online

  13. DavidBiolo说道:

    http://viagras.online/# viagra without prescription

  14. Charlesvox说道:

    https://viagras.online/# Sildenafil 100mg price

  15. Georgefrege说道:

    Buy Cialis online: buy cialis online – Cialis without a doctor prescription

  16. Elmersoalf说道:

    Purchase Cenforce Online buy cenforce cheapest cenforce

  17. Elmersoalf说道:

    generic sildenafil Buy Viagra online cheap viagra without prescription

  18. Jamesexite说道:

    cenforce for sale: Cenforce 150 mg online – cenforce.pro

  19. DavidBiolo说道:

    http://viagras.online/# viagra canada

  20. Charlesvox说道:

    https://levitrav.store/# buy Levitra over the counter

  21. Jamesexite说道:

    Buy Cialis online: buy cialis overseas – cheapest cialis

  22. Tylerreunk说道:

    https://kamagra.win/# super kamagra

  23. Georgefrege说道:

    sildenafil 50 mg price: Buy Viagra online – order viagra

  24. Elmersoalf说道:

    cheapest cenforce Cenforce 150 mg online cenforce for sale

  25. Charlesvox说道:

    https://kamagra.win/# super kamagra

  26. Tylerreunk说道:

    https://cenforce.pro/# cenforce for sale

  27. Charlesvox说道:

    https://viagras.online/# buy viagra here

  28. Elmersoalf说道:

    Vardenafil buy online levitrav.store Levitra 20 mg for sale

  29. Elmersoalf说道:

    Cialis without a doctor prescription Generic Tadalafil 20mg price cheapest cialis

  30. Jamesexite说道:

    buy cenforce: cenforce for sale – cenforce for sale

  31. Jamesexite说道:

    Cheap Cialis: Generic Cialis without a doctor prescription – Buy Tadalafil 5mg

  32. Charlesvox说道:

    https://cialist.pro/# Generic Tadalafil 20mg price

  33. DavidBiolo说道:

    http://levitrav.store/# buy Levitra over the counter

  34. Georgefrege说道:

    Buy Vardenafil online: Levitra generic price – Levitra generic best price

  35. Elmersoalf说道:

    Kamagra 100mg price buy kamagra online super kamagra

  36. Jamesexite说道:

    Levitra 10 mg best price: Vardenafil online prescription – Buy Vardenafil online

  37. RandallGuesE说道:

    propecia rx: propecia buy – buying cheap propecia without insurance

  38. WilliamRen说道:

    https://cytotec.club/# buy cytotec online

  39. Davidfrify说道:

    tamoxifen for breast cancer prevention nolvadex 20mg tamoxifen men

  40. Davidfrify说道:

    п»їcipro generic ciprofloxacin over the counter cipro

  41. RonaldSwobe说道:

    http://lisinopril.network/# lisinopril generic over the counter

  42. RandallGuesE说道:

    ciprofloxacin: buy ciprofloxacin over the counter – ciprofloxacin over the counter

  43. RandallGuesE说道:

    order cytotec online: buy cytotec – cytotec abortion pill

  44. RonaldSwobe说道:

    http://ciprofloxacin.tech/# ciprofloxacin generic price

  45. WilliamRen说道:

    http://finasteride.store/# get propecia without a prescription

  46. Davidfrify说道:

    purchase cytotec buy cytotec online buy cytotec pills

  47. Davidfrify说道:

    order propecia propecia brand name cost of propecia without rx

  48. Davidfrify说道:

    cost of propecia without insurance cheap propecia pill generic propecia without a prescription

  49. RandallGuesE说道:

    cheap propecia: get cheap propecia without a prescription – cost cheap propecia without prescription

发表回复

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