【问题标题】:Nginx location domain.ltd regexNginx 位置域.ltd 正则表达式
【发布时间】:2019-09-20 13:26:19
【问题描述】:

我需要重写域 whois 例如 http://domainname.ltd/example.com 必须调用 http://domainname.ltd/whois.php?d=example.com

我尝试了位置示例,但不起作用。

【问题讨论】:

    标签: nginx url-rewriting location


    【解决方案1】:

    你可以这样做:

    server {
      listen 80;
      server_name test.com;
    
      location = /whois.php {
        proxy_pass http://your_origin_host.com
      }
    
      location ~ \/(.*) {
        set $domain_query $1;
        set $args "d=${domain_query}";
        rewrite ^ /whois.php last;
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2020-09-11
      • 2017-04-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-03
      • 1970-01-01
      • 1970-01-01
      • 2014-11-11
      相关资源
      最近更新 更多