Create a Virtual host on a shared ip
Submitted by chris on January 26, 2006 - 18:21.
httpd.conf & .htaccess
1) Tell Apache to listen on the new ip (port 80 the default HTTP port):
Listen 63.123.139.159:80
NameVirtualHost 63.123.139.159
2) Next create a <VirtualHost> block for each different host that you would like to serve.
The argument to <VirtualHost> must match exactly the one used with NameVirtualHost.
#VirtualHost1 with a DocumentRoot at least 1 ServerName
<VirtualHost 63.123.139.159>
ServerName www.sitebuddy.com
ServerAlias sitebuddy.com *.sitebuddy.com
DocumentRoot E:/DomZeus/sitebuddycom/wwwroot
#You can also add a custom log here
</VirtualHost>
If running Apache under a restricted local account, make sure that account has the appropriate rights on the web content and log folders.
If you want to log all your virtual host to the same log and have Awstats report the alias traffic see:
http://awstats.sourceforge.net/docs/awstats_extra.html#domainaliases
Note:
Listen Directive scope: server config
NameVirtualHost Directive scope: server config
VirtualHost Directive scope: server config
ServerName Directive scope: server config, virtual host
ServerAlias Directive scope: server config, virtual host
DocumentRoot Directive scope: server config, virtual host
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen
http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost
http://httpd.apache.org/docs/2.2/mod/core.html#virtualhost
http://httpd.apache.org/docs/2.2/mod/core.html#servername
http://httpd.apache.org/docs/2.2/mod/core.html#serveralias
http://httpd.apache.org/docs/2.2/mod/core.html#documentroot
Listen 63.123.139.159:80
NameVirtualHost 63.123.139.159
2) Next create a <VirtualHost> block for each different host that you would like to serve.
The argument to <VirtualHost> must match exactly the one used with NameVirtualHost.
#VirtualHost1 with a DocumentRoot at least 1 ServerName
<VirtualHost 63.123.139.159>
ServerName www.sitebuddy.com
ServerAlias sitebuddy.com *.sitebuddy.com
DocumentRoot E:/DomZeus/sitebuddycom/wwwroot
#You can also add a custom log here
</VirtualHost>
If running Apache under a restricted local account, make sure that account has the appropriate rights on the web content and log folders.
If you want to log all your virtual host to the same log and have Awstats report the alias traffic see:
http://awstats.sourceforge.net/docs/awstats_extra.html#domainaliases
Note:
Listen Directive scope: server config
NameVirtualHost Directive scope: server config
VirtualHost Directive scope: server config
ServerName Directive scope: server config, virtual host
ServerAlias Directive scope: server config, virtual host
DocumentRoot Directive scope: server config, virtual host
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#listen
http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost
http://httpd.apache.org/docs/2.2/mod/core.html#virtualhost
http://httpd.apache.org/docs/2.2/mod/core.html#servername
http://httpd.apache.org/docs/2.2/mod/core.html#serveralias
http://httpd.apache.org/docs/2.2/mod/core.html#documentroot


delicious
digg
reddit
google
technorati