V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
您的好友邀请您体验AI多模型共享资源
海量资源池 · 异常自动切换 · 分布式架构 · 故障自动转移 共享方案:仅 $55/月 opus 每天5小时官方限制 Claude sonnet 4无限量 Codex公测中。免费体验
Promoted by 0x3751
coolloyal
V2EX  ›  Linux

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

  •  
  •   coolloyal · 2014-04-14 15:59:38 +08:00 · 3518 次点击
    这是一个创建于 4179 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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   ·   实用小工具   ·   4754 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:52 · PVG 11:52 · LAX 20:52 · JFK 23:52
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.