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

/ 9,016评论 / 42201阅读 / 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. RobertEsses说道:

    http://tadalafiliq.com/# Buy Tadalafil 10mg

  2. Ralphnus说道:

    http://kamagraiq.shop/# Kamagra 100mg price

  3. RobertEsses说道:

    http://sildenafiliq.com/# Cheap Sildenafil 100mg

  4. Johnniecew说道:

    http://tadalafiliq.shop/# Cialis 20mg price

  5. Danielleant说道:

    cheap viagra buy viagra online Generic Viagra for sale

  6. Danielleant说道:

    Kamagra 100mg price Kamagra Oral Jelly Price п»їkamagra

  7. RobertEsses说道:

    http://sildenafiliq.xyz/# sildenafil 50 mg price

  8. Chesterbloks说道:

    buy cialis pill: Buy Cialis online – cheapest cialis

  9. Hi! Do you know if they make any plugins
    to help with SEO? I’m trying to get my website to rank for some targeted
    keywords but I’m not seeing very good results. If you know of any please
    share. Cheers! You can read similar art here: Backlinks List

  10. Danielleant说道:

    Kamagra 100mg Kamagra Oral Jelly Price super kamagra

  11. Danielleant说道:

    Kamagra tablets Kamagra 100mg price cheap kamagra

  12. Johnniecew说道:

    https://kamagraiq.com/# Kamagra 100mg price

  13. Chesterbloks说道:

    п»їcialis generic: cialis best price – Cialis 20mg price in USA

  14. Danielleant说道:

    Cialis without a doctor prescription tadalafil iq п»їcialis generic

  15. Ralphnus说道:

    https://kamagraiq.shop/# buy kamagra online usa

  16. Danielleant说道:

    cheap kamagra Kamagra Oral Jelly Price super kamagra

  17. Johnniecew说道:

    http://tadalafiliq.shop/# Buy Tadalafil 5mg

  18. Chesterbloks说道:

    Buy Tadalafil 20mg: cialis without a doctor prescription – Buy Tadalafil 20mg

  19. Danielleant说道:

    Kamagra tablets kamagra best price Kamagra Oral Jelly

  20. Danielleant说道:

    Buy Tadalafil 20mg Buy Cialis online Cialis without a doctor prescription

  21. Ralphnus说道:

    https://tadalafiliq.shop/# Cialis over the counter

  22. Chesterbloks说道:

    sildenafil online: sildenafil iq – Sildenafil 100mg price

  23. Danielleant说道:

    viagra canada generic ed pills п»їBuy generic 100mg Viagra online

  24. Johnniecew说道:

    http://tadalafiliq.com/# Buy Tadalafil 10mg

  25. Danielleant说道:

    Cheapest Sildenafil online sildenafil iq buy Viagra online

  26. Ralphnus说道:

    http://tadalafiliq.com/# Cialis 20mg price in USA

  27. ladesbet ラティーナポルノ ladestinemi.kHKym2xIAOq

  28. Davidboano说道:

    prednisone 54899 prednisone 40 mg price prednisone price

  29. Davidboano说道:

    50 mg prednisone tablet prednisone 20mg capsule prednisone 300mg

  30. ladesbet ਹਾਰਡਕੋਰ ਪੋਰਨੋਗ੍ਰਾਫੀ ladesinemi.WBfrqKwt1B9

  31. Edwardsmors说道:

    canadian pharmacy amoxicillin: rexall pharmacy amoxicillin 500mg – amoxicillin in india

  32. DavidEvedo说道:

    online prednisone 5mg: prednisone 60 mg daily – prednisone prescription for sale

  33. Davidboano说道:

    prednisone 5443 buy prednisone without a prescription prednisone tablet 100 mg

  34. Jamesscurl说道:

    http://zithromaxall.com/# purchase zithromax online

  35. Davidboano说道:

    buy zithromax online cheap zithromax purchase online zithromax for sale cheap

  36. Edwardsmors说道:

    how to get clomid without rx: cost cheap clomid – order cheap clomid

  37. Davidboano说道:

    prednisone 10 mg over the counter cost of prednisone in canada prednisone 10 mg tablet

  38. Davidboano说道:

    prednisone 20 mg prednisone uk generic prednisone pills

  39. Jamesscurl说道:

    https://amoxilall.shop/# 875 mg amoxicillin cost

  40. DavidEvedo说道:

    25 mg prednisone: prednisone 50 mg coupon – prednisone over the counter uk

  41. Davidboano说道:

    generic clomid for sale buy generic clomid without dr prescription can i order clomid

  42. Davidboano说道:

    prednisone 50 mg tablet cost cheap prednisone online prednisone 1 tablet

  43. Edwardsmors说道:

    where to buy zithromax in canada: where to get zithromax – zithromax 1000 mg pills

  44. DavidEvedo说道:

    1 mg prednisone daily: prednisone 5mg daily – where can i order prednisone 20mg

  45. Davidboano说道:

    prednisone 5 mg tablet rx buy prednisone online australia prednisone 10 mg daily

  46. Davidboano说道:

    zithromax for sale online where can i get zithromax zithromax online usa

  47. Jamesscurl说道:

    https://zithromaxall.shop/# zithromax 250mg

  48. GSA List说道:

    Hello there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my blog to rank for some
    targeted keywords but I’m not seeing very good success.

    If you know of any please share. Many thanks! You can read similar article here: Hitman.agency

  49. Edwardsmors说道:

    buy prednisone online canada: buy prednisone mexico – order prednisone 10 mg tablet

发表回复

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