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

/ 9,031评论 / 42230阅读 / 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. CharlesGib说道:

    prednisone without rx: canada buy prednisone online – prednisone 10mg tablet cost

  2. Richardfrota说道:

    amoxicillin online purchase: amoxicillin 500 tablet – amoxicillin brand name

  3. MarvinMek说道:

    doxy price of doxycycline doxycycline order online

  4. Felipelam说道:

    http://pharmcanada.shop/# pharmacy in canada

  5. Williamfug说道:

    canadian pharmacies not requiring prescription: pharm world – non prescription medicine pharmacy

  6. Donaldkenty说道:

    the canadian pharmacy: canadian drug pharmacy – canada pharmacy online

  7. Williamfug说道:

    online pharmacy not requiring prescription: online pharmacies no prescription usa – buy medications without a prescription

  8. DavidTaK说道:

    online canadian pharmacy coupon pharm world legal online pharmacy coupon code

  9. DonaldtAg说道:

    online pharmacy no prescription: online pharmacies without prescriptions – no prescription canadian pharmacies

  10. Felipelam说道:

    https://pharmworld.store/# online pharmacy no prescription

  11. Williamfug说道:

    canada cloud pharmacy: canadian drugs online – canada pharmacy reviews

  12. Felipelam说道:

    http://pharmworld.store/# prescription free canadian pharmacy

  13. Felipelam说道:

    http://pharmindia.online/# top 10 pharmacies in india

  14. DavidTaK说道:

    india pharmacy mail order indian pharmacy indian pharmacy

  15. Williamfug说道:

    Online medicine order: indian pharmacy – online shopping pharmacy india

  16. Williamfug说道:

    mail order pharmacy india: indian pharmacy paypal – indianpharmacy com

  17. DavidTaK说道:

    best no prescription online pharmacy canada mail order prescription canada prescription drugs online

  18. DavidTaK说道:

    indian pharmacy online indian pharmacy Online medicine order

  19. Felipelam说道:

    http://pharmindia.online/# indianpharmacy com

  20. Williamfug说道:

    mexican mail order pharmacies: medication from mexico pharmacy – purple pharmacy mexico price list

  21. DonaldtAg说道:

    mexican pharmaceuticals online: best online pharmacies in mexico – mexican rx online

  22. Felipelam说道:

    https://pharmcanada.shop/# canadian pharmacy store

  23. Felipelam说道:

    http://pharmcanada.shop/# onlinepharmaciescanada com

  24. DavidTaK说道:

    pharmacies in mexico that ship to usa pharmacies in mexico that ship to usa medicine in mexico pharmacies

  25. Williamfug说道:

    best online pharmacy no prescription: cheapest pharmacy – online pharmacy discount code

  26. DonaldtAg说道:

    mexican online pharmacies prescription drugs: mexican online pharmacies prescription drugs – mexican drugstore online

  27. Williamfug说道:

    canadian pharmacy no prescription: pharm world store – online pharmacy no prescription needed

  28. DavidTaK说道:

    canada discount pharmacy canadian pharmacy online reviews canadian pharmacy sarasota

  29. DavidTaK说道:

    cheapest pharmacy for prescriptions pharm world store canadian pharmacy coupon

  30. Felipelam说道:

    https://pharmcanada.shop/# certified canadian international pharmacy

  31. Jeromeviaph说道:

    http://pharmmexico.online/# buying prescription drugs in mexico

  32. Williamfug说道:

    canadian pharmacy no prescription required: canada prescriptions by mail – buy pills without prescription

  33. Felipelam说道:

    http://pharmcanada.shop/# thecanadianpharmacy

  34. DonaldtAg说道:

    п»їlegitimate online pharmacies india: indian pharmacy online – india online pharmacy

  35. Felipelam说道:

    https://pharmworld.store/# online pharmacy discount code

  36. DavidTaK说道:

    cheapest prescription pharmacy online pharmacy best canadian pharmacy no prescription

  37. Williamfug说道:

    pharmacies in mexico that ship to usa: medicine in mexico pharmacies – mexican online pharmacies prescription drugs

  38. Williamfug说道:

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

  39. DavidTaK说道:

    pharmacy coupons cheapest pharmacy canadian prescription pharmacy

  40. Donaldkenty说道:

    safe canadian pharmacy: adderall canadian pharmacy – canadian drug prices

  41. DavidTaK说道:

    online canadian pharmacy coupon cheapest pharmacy cheapest prescription pharmacy

  42. Felipelam说道:

    http://pharmcanada.shop/# canada drugs online

  43. Williamfug说道:

    uk pharmacy no prescription: online pharmacy – cheapest pharmacy to fill prescriptions with insurance

  44. Donaldkenty说道:

    buy prescription drugs from india: online shopping pharmacy india – indian pharmacy paypal

  45. Felipelam说道:

    https://pharmworld.store/# uk pharmacy no prescription

  46. DonaldtAg说道:

    quality prescription drugs canada: canada pharmacy no prescription – pharmacy with no prescription

  47. DavidTaK说道:

    canada pharmacies online prescriptions no prescription best online pharmacies without prescription

  48. Felipelam说道:

    https://pharmworld.store/# buying prescription drugs from canada

  49. Williamfug说道:

    mexico drug stores pharmacies: best online pharmacies in mexico – buying from online mexican pharmacy

  50. DavidTaK说道:

    buy prescription drugs from india mail order pharmacy india top 10 online pharmacy in india

发表回复

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