This document attempts to answer the commonly-asked questions about setting up virtual hosts.
These scenarios are those involving multiple web sites running on a single server, via name-based or IP-based virtual hosts.
On some of my addresses, I want to do name-based virtual hosts, and on others, IP-based hosts.
##############################################
Server configuration
Listen 80
NameVirtualHost 172.20.30.40
<VirtualHost 172.20.30.40>
DocumentRoot /www/example1
ServerName http://www.example1.com/
</VirtualHost>
<VirtualHost 172.20.30.40>
DocumentRoot /www/example2
ServerName http://www.example2.org/
</VirtualHost>
<VirtualHost 172.20.30.40>
DocumentRoot /www/example3
ServerName http://www.example3.net/
</VirtualHost>
# IP-based
<VirtualHost 172.20.30.50>
DocumentRoot /www/example4
ServerName http://www.example4.edu/
</VirtualHost>
<VirtualHost 172.20.30.60>
DocumentRoot /www/example5
ServerName http://www.example5.gov/
</VirtualHost>
##############################################
These scenarios are those involving multiple web sites running on a single server, via name-based or IP-based virtual hosts.
On some of my addresses, I want to do name-based virtual hosts, and on others, IP-based hosts.
##############################################
Server configuration
Listen 80
NameVirtualHost 172.20.30.40
<VirtualHost 172.20.30.40>
DocumentRoot /www/example1
ServerName http://www.example1.com/
</VirtualHost>
<VirtualHost 172.20.30.40>
DocumentRoot /www/example2
ServerName http://www.example2.org/
</VirtualHost>
<VirtualHost 172.20.30.40>
DocumentRoot /www/example3
ServerName http://www.example3.net/
</VirtualHost>
# IP-based
<VirtualHost 172.20.30.50>
DocumentRoot /www/example4
ServerName http://www.example4.edu/
</VirtualHost>
<VirtualHost 172.20.30.60>
DocumentRoot /www/example5
ServerName http://www.example5.gov/
</VirtualHost>
##############################################
No comments:
Post a Comment