V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
coolloyal
V2EX  ›  Linux

Nginx 下泛域名反代报错,有人解决过吗?

  •  
  •   coolloyal · 2014-04-14 15:59:38 +08:00 · 3033 次点击
    这是一个创建于 3682 天前的主题,其中的信息可能已经有所发展或是发生改变。
    server {
    listen 80;
    server_name ~^(www\.)?(?<domain>.+)\..+$;
    index index.php index.html index.htm;

    location / {
    resolver 8.8.8.8
    proxy_pass http://$domain.xxx.com/;
    }
    }

    这个情况502错误,
    4 条回复    1970-01-01 08:00:00 +08:00
    julyclyde
        1
    julyclyde  
       2014-04-14 16:31:54 +08:00
    $domain 可以在server_name里“顺便”声明吗?
    你看看日志咋写的
    cevincheung
        2
    cevincheung  
       2014-04-14 16:42:43 +08:00
    server_name domain.com *.domain.com
    hourui
        3
    hourui  
       2014-04-14 23:37:43 +08:00
    resolver 8.8.8.8
    少了个分号吧,亲。
    chekun
        4
    chekun  
       2014-04-15 15:29:04 +08:00
    resolver 要写到http {} 中去,在server中是无效的,详情参见手册.
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1546 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:01 · PVG 01:01 · LAX 10:01 · JFK 13:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.