Created
January 13, 2013 21:59
-
-
Save abhishekkr/4526414 to your computer and use it in GitHub Desktop.
Apache HTTPD VirtualHost ~ story of default route opted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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