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

/ 9,243评论 / 42742阅读 / 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. Derekjup说道:

    prednisone tablets india: cheap prednisone – can i order prednisone

  2. StevenWearo说道:

    prednisone 40 mg daily: raypharm – prednisone pill prices

  3. Brandenven说道:

    cost of clomid no prescription: cheap clomid – can i buy cheap clomid tablets

  4. Derekjup说道:

    prednisone price south africa: buy prednisone online australia – prednisone pill 10 mg

  5. Brandenven说道:

    can i buy generic clomid no prescription: clomid rex pharm – where buy cheap clomid without dr prescription

  6. Brandenven说道:

    dapoxetine price: buy dapoxetine online – cheap priligy

  7. Derekjup说道:

    amoxicillin 500mg tablets price in india: buy amoxil online – amoxicillin no prescription

  8. StevenWearo说道:

    order generic clomid pill: clomid – where buy clomid price

  9. Brandenven说道:

    Priligy tablets: buy priligy – Priligy tablets

  10. StevenWearo说道:

    where to buy prednisone in canada: ray pharm – prednisone cost us

  11. Brandenven说道:

    clomid without rx: clomid – clomid

  12. Brandenven说道:

    buying clomid pills: clomid – can i get clomid no prescription

  13. Brandenven说道:

    buy prednisone 10mg online: prednisoneraypharm – prednisone without prescription.net

  14. Derekjup说道:

    amoxicillin 875 mg tablet: cheap amoxil – amoxicillin cephalexin

  15. Derekjup说道:

    amoxicillin 500 mg cost: amoxil com pharm – amoxicillin without a prescription

  16. StevenWearo说道:

    over the counter amoxicillin: amoxicillin 500 mg capsule – amoxicillin 500mg price in canada

  17. Derekjup说道:

    buying amoxicillin online: amoxil – can you buy amoxicillin over the counter in canada

  18. StevenWearo说道:

    cheap clomid online: rexpharm – how to get generic clomid online

  19. Derekjup说道:

    can i order cheap clomid tablets: rexpharm – get clomid

  20. Brandenven说道:

    where to buy prednisone 20mg: prednisone ray pharm – prednisone pharmacy

  21. Brandenven说道:

    amoxicillin over the counter in canada: where can you buy amoxicillin over the counter – amoxicillin 500mg no prescription

  22. Узнай все о варикоцеле причины варикоцеле 3 степени

  23. Brandenven说道:

    can i purchase cheap clomid without insurance: clomid online – can i purchase clomid price

  24. StevenWearo说道:

    how to get clomid: generic clomid – can you get clomid without a prescription

  25. StevenWearo说道:

    can i buy clomid no prescription: rex pharm – buying cheap clomid no prescription

  26. StevenWearo说道:

    how to buy clomid online: cheap clomid – where can i get clomid now

  27. Bradleyarrip说道:

    buy prednisone online canada prednisoneraypharm average cost of generic prednisone

  28. Derekjup说道:

    where to get generic clomid without dr prescription: rexpharm – cheap clomid pill

  29. Bradleyarrip说道:

    priligy max pharm cheap priligy buy priligy

  30. Derekjup说道:

    cost of amoxicillin: amoxil com pharm – purchase amoxicillin online without prescription

  31. Brandenven说道:

    Priligy tablets: priligy – priligy maxpharm

  32. Bradleyarrip说道:

    priligy max pharm max pharm max pharm

  33. Derekjup说道:

    can you get cheap clomid price: buy clomid – how to get generic clomid without a prescription

  34. Brandenven说道:

    priligy maxpharm: priligy max pharm – priligy

  35. Derekjup说道:

    dapoxetine online: buy dapoxetine online – priligy

  36. StevenWearo说道:

    price of prednisone tablets: raypharm – buy 40 mg prednisone

  37. Тут можно преобрести сейфов для оружия купить шкаф оружейный

  38. Brandenven说道:

    priligy maxpharm: Priligy tablets – buy dapoxetine online

  39. StevenWearo说道:

    can i buy clomid no prescription: generic clomid – can you get generic clomid without rx

  40. StevenWearo说道:

    amoxicillin canada price: purchase amoxicillin online without prescription – amoxicillin capsule 500mg price

发表回复

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