[NTLUG:Discuss] Virtual Web Server

David Simmons dave at dgnal.net
Sun Apr 18 19:06:28 CDT 2010


right above your individual definitions....you need to tell it that you're
actually doing virtual hosting......you do that by removing the # from
before the 'NameVirtualHost' line:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

and make sure you restart the HTTP service each time you need to reload the
httpd.conf file

You're also missing the 'ServerName:' definition within each of your virtual
webs.....you want something like this:

<VirtualHost *:80>
    DocumentRoot /var/www/html/somesite.com
    ServerName www.somesite.com
    ServerAlias somesite.com
    ErrorLog logs/somesite.com-error_log
    CustomLog logs/somesite.com-access_log common
</VirtualHost>

hope that helps,

-dave

On Sun, Apr 18, 2010 at 6:49 PM, Stuart Johnston <saj at thecommune.net> wrote:

> Looks like you are missing the NameVirtualHost directive.
>
> http://httpd.apache.org/docs/2.0/mod/core.html#namevirtualhost
>
>
>
> Dennis Rice wrote:
>
>> OK, on for another class and trying to set up virtual web server.  I have
>> gone through multiple google sites including the apache site.  There are
>> multiple types of virtual hosting, those being by domain name, subdomain,
>> and multiple IP addresses.  At the moment working on the multiple domain
>> name.  I am running on fedora 11.  All three domains in this test example
>> have been set up in the /etc/hosts table to the same IP address.  The first
>> one going to test.org works.
>>
>> I set up the httpd.conf file to read:
>> <VirtualHost *:80>                        #Tried *=>test.org
>>   ServerAdmin root at test.org
>>   DocumentRoog /var/www/html
>>   ServerName svr.test.org
>> </VirtualHost>
>>
>> <VirtualHost *:80>                           #Tried *=>test1.org
>>   ServerAdmin root at test.org         #Am I wrong?  This is the base
>> server.
>>   DocumentRoot /var/www/test1
>> </VirtualHost *:80
>>
>> <VirtualHost *:80>                           #Tried *=>test2.org
>>  ServarAdmin root at test.org         #Again
>>  DocumentRoot /var/www/test2
>> </VirtualHost *:80>
>>
>> I attempted to change the * in each VH to the domain name, but it still
>> did not work.
>>
>> Originally had ServerName set to the computername, but took it out, no
>> difference.
>> Originally had ErrorLog set to /var/log/httpd/error_log, but took it out,
>> no difference.
>> Originally had CustomLog set to /var/log/httpd/access_log, but got error
>> saying I needed two variables, took out and it caused no problems (at this
>> time).
>>
>> Would appreciate assistance in figuring this out so I can document and
>> show the class how to make it work.
>>
>> Dennis
>>
>> _______________________________________________
>> http://www.ntlug.org/mailman/listinfo/discuss
>>
>
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>



-- 
Those with sight believe what's believable. Those with vision know what's
unbelievable.


More information about the Discuss mailing list