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

/ 9,307评论 / 42914阅读 / 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. Alexander John Gordon, Architect.

  2. 19 P. L. Vaidya, ed., The Madhyamakasastra of Nagarjuna with the Commentary Prasannapada by Candrakirti (Darbhanga: Mithila Institute of Postgraduate Research, 1960), xv.

  3. Ellis Mary Agatha Fane-Saunders, until not too long ago a member of the United Kingdom neighborhood in Karachi, Pakistan.

  4. Since 1982, greater than 24 million acres of agricultural land had been developed to non-farm uses together with roads, buying malls and subdivisions.

  5. Bradleyarrip说道:

    amoxicillin order online Amoxicillin Com Pharm amoxicillin cephalexin

  6. Derekjup说道:

    priligy: priligy – max pharm

  7. D . 400S, the Greek philosopher Dionysius the Areopagite described a hierarchy of angels.

  8. Derekjup说道:

    6 prednisone: ray pharm – prednisone 5mg over the counter

  9. DanielArill说道:

    where can you get amoxicillin http://amoxilcompharm.com/# amoxicillin 500mg buy online canada

  10. DanielArill说道:

    amoxicillin 500mg capsule buy online http://priligymaxpharm.com/# Priligy tablets

  11. Brandenven说道:

    buy dapoxetine online: dapoxetine online – priligy maxpharm

  12. Bradleyarrip说道:

    can i buy clomid prices clomid purchase online rex pharm where to buy cheap clomid tablets

  13. Derekjup说道:

    priligy max pharm: buy dapoxetine online – Priligy tablets

  14. Brandenven说道:

    how much is amoxicillin: com pharm – amoxicillin 500 mg without prescription

  15. Derekjup说道:

    buy priligy max pharm: cheap priligy – max pharm

  16. StevenWearo说道:

    buying cheap clomid without dr prescription: clomid purchase online rex pharm – can you get cheap clomid without prescription

  17. Brandenven说道:

    where can i buy cheap clomid without insurance: where to buy generic clomid prices – how to get generic clomid online

  18. DanielArill说道:

    amoxicillin over the counter in canada http://priligymaxpharm.com/# buy dapoxetine online

  19. StevenWearo说道:

    cheap clomid without insurance: clomid – where buy cheap clomid no prescription

  20. ShaunLolve说道:

    ed medicines https://canadiandrugsgate.com/# fast ed meds online
    male ed drugs

  21. ShaunLolve说道:

    ed pumps http://canadiandrugsgate.com/# ambien without a doctor’s prescription
    vitamins for ed

  22. Jefferyswava说道:

    mexico pharmacies prescription drugs: Mexican Pharm Gate – reputable mexican pharmacies online

  23. LarryHer说道:

    reputable mexican pharmacies online: Mexican Pharmacy Gate – mexico drug stores pharmacies

  24. Тут можно преобрести сейф несгораемый купить пожаростойкие сейфы

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

  26. LarryHer说道:

    india pharmacy: Indian pharmacy to USA – top 10 online pharmacy in india

  27. Тут можно преобрести сейф огнестойкий в москве купить несгораемый сейф

  28. Bradleyarrip说道:

    http://canadiandrugsgate.com/# natural cure for ed

  29. Bradleyarrip说道:

    https://mexicanpharmgate.com/# medication from mexico pharmacy

  30. LarryHer说道:

    п»їbest mexican online pharmacies: mexican pharmacy online – buying from online mexican pharmacy

  31. Bradleyarrip说道:

    https://indianpharmacyeasy.com/# india pharmacy mail order

  32. Stairlift说道:

    Oh my goodness! Amazing article dude! Thank you, However I am encountering issues with your RSS. I don’t understand why I cannot subscribe to it. Is there anyone else having identical RSS problems? Anyone that knows the answer will you kindly respond? Thanks!

  33. Bradleyarrip说道:

    http://indianpharmacyeasy.com/# п»їlegitimate online pharmacies india

  34. Jefferyswava说道:

    best ed pills at gnc: Canada pharmacy online – muse ed drug

  35. GlennSeade说道:

    reputable indian online pharmacy Online medicine home delivery online pharmacy india

  36. Jefferyswava说道:

    mexico drug stores pharmacies: medicines mexico rx online – medicine in mexico pharmacies

  37. Jefferyswava说道:

    reputable mexican pharmacies online: mexican pharmacy – reputable mexican pharmacies online

  38. LarryHer说道:

    mexican mail order pharmacies: Mexican Pharm Gate – buying from online mexican pharmacy

  39. LarryHer说道:

    pharmacy website india: indianpharmacyeasy – Online medicine order

  40. Jefferyswava说道:

    best online pharmacies in mexico: Mexican Pharmacy Gate – reputable mexican pharmacies online

  41. Здесь можно преобрести сейфы купить сейф

  42. GlennSeade说道:

    ed drug comparison canadiandrugsgate pump for ed

  43. GlennSeade说道:

    reputable indian online pharmacy Indian pharmacy to USA india pharmacy mail order

  44. Bradleyarrip说道:

    http://mexicanpharmgate.com/# mexico pharmacies prescription drugs

  45. сейф说道:

    Здесь можно преобрести где купить сейф сейф купить цена

  46. LarryHer说道:

    buying prescription drugs in mexico online: mexican drugstore online – mexico drug stores pharmacies

  47. Bradleyarrip说道:

    https://mexicanpharmgate.com/# mexican drugstore online

  48. Bradleyarrip说道:

    http://canadiandrugsgate.com/# best male enhancement pills

  49. Jefferyswava说道:

    reputable indian online pharmacy: indian pharmacy – india online pharmacy

发表回复

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