I have the following in my vhosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ci.myserver.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
ProxyPassReverseCookiePath / /
</VirtualHost>
Now, when I visit my root (myserver.com) I get my Jenkins, as well as when I visit ci.myserver.com
How to I get not redirected to CI when I visit myserver.com, but only make it work for ci.myserver.com
Updated version
This resolved an issue.
<VirtualHost *:80>
ServerName ci.myserver.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / ajp://127.0.0.1:8009/
ProxyPassReverse / ajp://127.0.0.1:8009/
ProxyPassReverseCookiePath / /
</VirtualHost>
<VirtualHost *:80>
ServerName myserver.com
DocumentRoot /
<Directory />
Require all granted
</Directory>
</VirtualHost>
You need to create another VirtualHost
, otherwise hostnames that resolve the ip of your server will hit the default VirtualHost
, which in your case is ci.myserver.com
.
Add another to the file:
<VirtualHost *:80>
ServerName myserver.com
DocumentRoot /path/to/root
<Directory /path/to/root>
Order allow,deny
allow from all
</Directory>
</VirtualHost>