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

/ 9,013评论 / 42191阅读 / 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. WilliamRen说道:

    https://nolvadex.life/# nolvadex generic

  2. RandallGuesE说道:

    is nolvadex legal: low dose tamoxifen – tamoxifen benefits

  3. Davidfrify说道:

    lisinopril 20 mg generic can i buy lisinopril over the counter prinivil 40 mg

  4. Davidfrify说道:

    cytotec buy online usa buy cytotec pills cytotec abortion pill

  5. WilliamRen说道:

    https://finasteride.store/# buy generic propecia pill

  6. RonaldSwobe说道:

    https://cytotec.club/# buy cytotec over the counter

  7. RandallGuesE说道:

    benicar lisinopril: lisinopril 10 mg no prescription – lisinopril 2.5 mg

  8. RandallGuesE说道:

    tamoxifen vs clomid: tamoxifen vs raloxifene – tamoxifen rash pictures

  9. WilliamRen说道:

    http://lisinopril.network/# lisinopril cheap brand

  10. Davidfrify说道:

    buy generic propecia buying generic propecia tablets cheap propecia without prescription

  11. WilliamRen说道:

    https://finasteride.store/# order cheap propecia without dr prescription

  12. RonaldSwobe说道:

    https://finasteride.store/# cost of generic propecia without insurance

  13. Davidfrify说道:

    prinivil 5 mg tablets lisinopril 3760 prinivil cost

  14. Davidfrify说道:

    buy cytotec online fast delivery cytotec buy online usa cytotec abortion pill

  15. WilliamRen说道:

    http://finasteride.store/# buy cheap propecia no prescription

  16. RandallGuesE说道:

    lisinopril 5 mg canada: lisinopril india – can you order lisinopril online

  17. RonaldSwobe说道:

    https://ciprofloxacin.tech/# п»їcipro generic

  18. RandallGuesE说道:

    tamoxifen breast cancer prevention: where can i buy nolvadex – where can i buy nolvadex

  19. Davidfrify说道:

    raloxifene vs tamoxifen tamoxifen for sale tamoxifen hot flashes

  20. WilliamRen说道:

    https://finasteride.store/# get generic propecia online

  21. RandallGuesE说道:

    buy cytotec online fast delivery: Misoprostol 200 mg buy online – buy cytotec over the counter

  22. Davidfrify说道:

    п»їcipro generic buy cipro cheap ciprofloxacin 500 mg tablet price

  23. Davidfrify说道:

    Misoprostol 200 mg buy online cytotec abortion pill cytotec buy online usa

  24. WilliamRen说道:

    http://lisinopril.network/# zestoretic 10 12.5

  25. WilliamRen说道:

    http://finasteride.store/# buying generic propecia tablets

  26. RandallGuesE说道:

    femara vs tamoxifen: tamoxifen headache – tamoxifen vs clomid

  27. RonaldSwobe说道:

    https://nolvadex.life/# tamoxifen lawsuit

  28. Davidfrify说道:

    hysterectomy after breast cancer tamoxifen tamoxifen tamoxifen citrate

  29. RandallGuesE说道:

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

  30. WilliamRen说道:

    https://nolvadex.life/# tamoxifen brand name

  31. RandallGuesE说道:

    lisinopril 7.5 mg: lisinopril online without prescription – lisinopril 10 12.5 mg

  32. Davidfrify说道:

    п»їcytotec pills online buy cytotec pills buy cytotec in usa

  33. Davidfrify说道:

    cipro for sale buy ciprofloxacin over the counter buy generic ciprofloxacin

  34. RonaldSwobe说道:

    https://lisinopril.network/# buy lisinopril 40 mg online

  35. WilliamRen说道:

    http://nolvadex.life/# tamoxifen cost

  36. RonaldSwobe说道:

    https://cytotec.club/# Misoprostol 200 mg buy online

  37. WilliamRen说道:

    http://cytotec.club/# Cytotec 200mcg price

  38. Davidfrify说道:

    propecia cheap propecia cost buying generic propecia tablets

  39. RandallGuesE说道:

    lisinopril 20mg 37.5mg: lisinopril 49 mg – website

  40. RandallGuesE说道:

    lisinopril 20 mg canadian: prinivil 25mg – lisinopril generic price in india

  41. Davidfrify说道:

    buying generic propecia cost propecia without rx order generic propecia pills

  42. Davidfrify说道:

    get generic propecia pills buy propecia without a prescription get propecia without rx

  43. WilliamRen说道:

    https://nolvadex.life/# tamoxifen for breast cancer prevention

  44. RandallGuesE说道:

    Cytotec 200mcg price: buy cytotec over the counter – buy cytotec over the counter

  45. Davidfrify说道:

    on line order lisinopril 20mg buy 20mg lisinopril lisinopril 5mg cost

  46. WilliamRen说道:

    http://cytotec.club/# order cytotec online

  47. WilliamRen说道:

    http://lisinopril.network/# buy lisinopril 20 mg no prescription

  48. Davidfrify说道:

    order propecia no prescription get propecia no prescription get propecia price

  49. Davidfrify说道:

    get propecia price buy cheap propecia without a prescription propecia sale

  50. RandallGuesE说道:

    generic propecia pills: order cheap propecia pill – cost cheap propecia pill

发表回复

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