【问题标题】:How can I use nginx to set a vhost and webroot on a URI of an existing vhost?如何使用 nginx 在现有虚拟主机的 URI 上设置虚拟主机和 webroot?
【发布时间】:2022-01-25 20:13:05
【问题描述】:

我想将虚拟主机的请求发送到git.domain1.tldsub.domain2.tld/git

我想这会与覆盖的文件发生冲突,那么我怎样才能让该域指向该位置?

【问题讨论】:

    标签: nginx dns webserver


    【解决方案1】:

    你可以试试这个:

    location / {
        proxy_pass https://sub.domain2.tld/git;
      }
    

    或者

    rewrite ^/$ https://sub.domain2.tld/git permanent;
    rewrite ^/(.*)$ https://sub.domain2.tld/git/$1 permanent;
    

    【讨论】:

      猜你喜欢
      • 2020-07-17
      • 2023-03-15
      • 1970-01-01
      • 2014-11-12
      • 2016-01-03
      • 2014-05-22
      • 2011-10-20
      • 2018-05-16
      • 2020-07-29
      相关资源
      最近更新 更多