Вот сделка.Мы запускаем задание Jenkins в каждой ветке git, поэтому, если тесты пройдены, он собирает проект и копирует файлы в / var / www (папку для поддоменов в Apache).
Наш файл virtualhosts.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>
Я могу легко получить доступ к thebranchname.subdomain.ourdomain.dk (и всем другим ветвям), но динамически создаваемым URL-адресам, таким как thebranchname.subdomain.ourdomain.dk/test, не могут быть доступны напрямую, как они должны быть.В настоящее время не имеет значения, находится ли следующее в файле virutalhosts.conf или нет.
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
Код перезаписи взят прямо из https://angular.io/guide/deployment
Есть идеи?