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

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

  •  
  •   c742435 · 2015-09-17 19:18:39 +08:00 · 2652 次点击
    这是一个创建于 3143 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    1 条回复    2015-09-17 20:57:06 +08:00
    gzlock
        1
    gzlock  
       2015-09-17 20:57:06 +08:00   ❤️ 1
    location / {
    proxy_pass http://localhost/$host/;
    # example: http://a.com/index.html ===> http://localhost/a.com/index.html
    proxy_set_header Host $host;
    }
    完事
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3388 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 12:26 · PVG 20:26 · LAX 05:26 · JFK 08:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.