使用Angular Deployment mod重写设置动态创建的子域

时间:2019-02-28 09:42:36

标签: angular apache

这是交易。我们在每个git分支上运行Jenkins作业,因此如果测试通过,它将构建项目并将文件复制到/ var / www(Apache上子域的文件夹)。

我们的virtualhosts.conf文件看起来如下:

responseMCQ

我可以轻松访问thebranchname.subdomain.ourdomain.dk(以及所有其他分支),但是像thebranchname.subdomain.ourdomain.dk/test这样的动态创建的url不能像应该的那样直接访问。现在,无论是否在virutalhosts.conf文件中都没有影响。

UseCanonicalName Off
<VirtualHost *:80>
  ServerName thebranchname.subdomain.ourdomain.dk
  ServerAlias *.subdomain.ourdomain.dk
  VirtualDocumentRoot /var/www/%1

  RewriteEngine On
    # If an existing asset or directory is requested go to it as it is
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteRule ^ - [L]
    # If the requested resource doesn't exist, use index.html
  RewriteRule ^ /index.html

</VirtualHost>

重写代码直接来自https://angular.io/guide/deployment

有什么想法吗?

0 个答案:

没有答案