V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
coolloyal
V2EX  ›  Linux

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

  •  
  •   coolloyal · Apr 14, 2014 · 3863 views
    This topic created in 4396 days ago, the information mentioned may be changed or developed.
    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 replies    1970-01-01 08:00:00 +08:00
    julyclyde
        1
    julyclyde  
       Apr 14, 2014
    $domain 可以在server_name里“顺便”声明吗?
    你看看日志咋写的
    cevincheung
        2
    cevincheung  
       Apr 14, 2014
    server_name domain.com *.domain.com
    hourui
        3
    hourui  
       Apr 14, 2014
    resolver 8.8.8.8
    少了个分号吧,亲。
    chekun
        4
    chekun  
       Apr 15, 2014
    resolver 要写到http {} 中去,在server中是无效的,详情参见手册.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3397 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 12:22 · PVG 20:22 · LAX 05:22 · JFK 08:22
    ♥ Do have faith in what you're doing.