# Multiple VirtualHosts Entry can be made to handle different internal servers serving via single external node | |
# Since it picks up first VirtualHost as default route... all unhandled requests served by first VirtualHost | |
NameVirtualHost *:80 | |
ServerName servernode | |
<VirtualHost *:80> | |
ServerName www.about.server.node | |
ServerAlias about.server.node | |
DocumentRoot /var/www/html/about | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName www.blog.server.node | |
ServerAlias blog.server.node | |
<Location /> | |
ProxyPass http://www.server01.node/blog | |
ProxyPassReverse http://www.server01.node/blog | |
ProxyPassReverseCookiePath /blog / | |
</Location> | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName www.projects.server.node | |
ServerAlias projects.server.node | |
<Location /> | |
ProxyPass http://www.server02.node/projects | |
ProxyPassReverse http://www.server02.node/projects | |
ProxyPassReverseCookiePath /projects / | |
</Location> | |
</VirtualHost> |
# If you just get left with one VirtualHost... all requests get left up to be served by it | |
NameVirtualHost *:80 | |
ServerName servernode | |
<VirtualHost *:80> | |
ServerName www.projects.server.node | |
ServerAlias projects.server.node | |
<Location /> | |
ProxyPass http://www.server02.node/projects | |
ProxyPassReverse http://www.server02.node/projects | |
ProxyPassReverseCookiePath /projects / | |
</Location> | |
</VirtualHost> |
# Since it picks up first VirtualHost as default route... something like this could be made to work | |
# explicitly providing a _default_:80 to spare Server the ambiguity | |
NameVirtualHost *:80 | |
ServerName servernode | |
<VirtualHost _default_:80> | |
DocumentRoot /var/www/html/404 | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName www.about.server.node | |
ServerAlias about.server.node | |
DocumentRoot /var/www/html/about | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName www.blog.server.node | |
ServerAlias blog.server.node | |
<Location /> | |
ProxyPass http://www.server01.node/blog | |
ProxyPassReverse http://www.server01.node/blog | |
ProxyPassReverseCookiePath /blog / | |
</Location> | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName www.projects.server.node | |
ServerAlias projects.server.node | |
<Location /> | |
ProxyPass http://www.server02.node/projects | |
ProxyPassReverse http://www.server02.node/projects | |
ProxyPassReverseCookiePath /projects / | |
</Location> | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment