V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
c742435
V2EX  ›  NGINX

请问 Nginx 配置如何搞单域名反向代理

  •  
  •   c742435 · Sep 17, 2015 · 3199 views
    This topic created in 3881 days ago, the information mentioned may be changed or developed.

    简而言之就是将 localhost/a.com/page.html 代理 a.com/page.html

    而且 a.com 是不确定的,无法列出。

    1 replies    2015-09-17 20:57:06 +08:00
    gzlock
        1
    gzlock  
       Sep 17, 2015   ❤️ 1
    location / {
    proxy_pass http://localhost/$host/;
    # example: http://a.com/index.html ===> http://localhost/a.com/index.html
    proxy_set_header Host $host;
    }
    完事
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2393 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 11:30 · PVG 19:30 · LAX 04:30 · JFK 07:30
    ♥ Do have faith in what you're doing.