V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
jsjcjsjc
V2EX  ›  NGINX

为啥这个反向代理不成功?

  •  
  •   jsjcjsjc · 2019-01-07 22:07:54 +08:00 · 2487 次点击
    这是一个创建于 2147 天前的主题,其中的信息可能已经有所发展或是发生改变。

    其他我照这写的都没问题啊~~就这个不行~~ 感谢感谢

    server
            {
                    listen 80;
                    server_name therouter.320.io;
    
    
                    if ($http_user_agent ~* (baiduspider|360spider|haosouspider|googlebot|soso|bing|sogou|yahoo|sohu-search|yodao|YoudaoBot|robozilla|msnbot|MJ12bot|NHN|Twiceler)) {
                    return  403;
                    }
    
                    location / {
                    sub_filter jsjcjsjc.asuscomm.com:50000 therouter.320.io;
                    sub_filter_once off;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Referer http://jsjcjsjc.asuscomm.com:50000;
                    proxy_set_header Host jsjcjsjc.asuscomm.com:50000;
                    proxy_pass http://jsjcjsjc.asuscomm.com:50000;
                    proxy_set_header Accept-Encoding "";
                    }
    }
    
    4 条回复    2019-01-08 20:43:18 +08:00
    qwefdrt
        1
    qwefdrt  
       2019-01-07 23:50:41 +08:00 via iPhone   ❤️ 1
    proxy_pass http://jsjcjsjc.asuscomm.com:50000;
    域名加端口?
    Honwhy
        2
    Honwhy  
       2019-01-08 10:06:58 +08:00   ❤️ 1
    查看一下 access_log,是不是替换后的 URL 不合法呢
    jsjcjsjc
        3
    jsjcjsjc  
    OP
       2019-01-08 20:43:04 +08:00
    @Honwhy 这个错误,看不明白啊
    2019/01/08 07:25:40 [error] 19114#0: *4 upstream timed out (110: Connection timed out) while connecting to upstream, client: 180.117.33.151, server: therouter.320.io, request: "GET / HTTP/1.1", upstream: "http://180.117.33.151:50000/", host: "therouter.320.io"
    2019/01/08 07:26:33 [error] 19114#0: *2 upstream timed out (110: Connection timed out) while connecting to upstream, client: 180.117.33.151, server: therouter.320.io, request: "GET /favicon.ico HTTP/1.1", upstream: "http://180.117.33.151:50000/favicon.ico", host: "therouter.320.io", referrer: "http://therouter.320.io/"
    jsjcjsjc
        4
    jsjcjsjc  
    OP
       2019-01-08 20:43:18 +08:00
    @qwefdrt 貌似还是不行~~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2986 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 13:16 · PVG 21:16 · LAX 05:16 · JFK 08:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.