Created
July 24, 2012 02:55
-
-
Save quietcricket/3167729 to your computer and use it in GitHub Desktop.
Apache multiple domain hosting config
This file contains hidden or 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
#This line is very important. It tells the server that this part is based on the name of the server, not IP address or anything else. | |
NameVirtualHost *:80 | |
# * means any ip address is fine. If you want to put, put your current server ip address. It's quite unlikely the server has multiple ip addresses. For normal people, * is good enough | |
<VirtualHost *:80> | |
#ServerName is used internally for Apache, so it does not matter what name you give it. As long as it does not conflict with other servers. | |
ServerName www.domain.tld | |
#This is the part specifies which domain it is serving. To be safe, always include the one without www and the one with www. | |
ServerAlias domain.tld www.domain.tld | |
#The files to be served for this domain. | |
DocumentRoot /www/domain | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName www.otherdomain.tld | |
ServerAlias otherdomain.tld www.otherdomain.tld | |
DocumentRoot /www/otherdomain | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment