Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
coolloyal
V2EX  ›  Linux

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

  •  
  •   coolloyal · Apr 14, 2014 · 4007 views
    This topic created in 4459 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   ·   964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 19:53 · PVG 03:53 · LAX 12:53 · JFK 15:53
    ♥ Do have faith in what you're doing.