[Techtalk] problems configuring apache virtual hosts

Whoppo whoppo at thunder.whoppo.net
Thu Nov 15 17:07:52 EST 2001


I've always found Name Virtual hosts for apache to be easier when
directly editing the /etc/httpd/conf/httpd.conf file.

If you open this file with you favorite editor (after making a backup of
the file, of course), towards the bottom of the file you'll see a section
called NameVirtualHost.  This is where you configure V-hosts..  Here's and
example from one of my webservers:

--Snip!--

NameVirtualHost 209.21.147.181

<VirtualHost www.whoppo.net>
        ServerAdmin sysadmin at whoppo.net
        ServerName www.whoppo.net
        DocumentRoot /home/httpd/html
        ErrorLog logs/host.www.whoppo.net-error_log
        TransferLog logs/host.www.whoppo.net-access_log
</VirtualHost>

<VirtualHost jupiter.whoppo.net>
        ServerAdmin sysadmin at whoppo.net
        ServerName jupiter.whoppo.net
        DocumentRoot /users/jupiter/public_html
        ErrorLog logs/host.jupiter.whoppo.net-error_log
        TransferLog logs/host.jupiter.whoppo.net-access_log
</VirtualHost>

--Snip!--

The first line (NameVirtualHost 209.21.147.181) tells apache to
use the following v-host directives for traffic received on that specific
IP address (machines with multiple IPs can can several of these sections)

The next line <VirtualHost your.hostname.net> is the address that a remote
user types to get to this virtual host.

The following lines are:
 (ServerAdmin) the email address of the system admin :)
 (ServerName) the name returned to the remote browser
 (DocumentRoot) the full path to the content for this site
 (ErrorLog) the error logfile for this site
 (TransferLog) the access logfile for this site

</VirtualHost> closes the config for this v-host.

The DNS entries for hostnames used must be in place before this will work
and changes made to the httpd.conf file won't take effect until the server
has been restarted ("killall -HUP httpd" will accomplish this)

Hope this helps!

Ron


On Tue, 13 Nov 2001, Amanda C. Clift wrote:

> Okay, Im getting more used to this everyday, thanks to everyone's help.
> However, I'm now trying to configure virtual hosts, and I'm having a bit
> of a problem.
> 
> I'm using linuxconf in a shell to configure it,and it looks like its
> doing it right..However, when i try to see my virtual hosts, it can't
> find them.
> *note for some reason the other guy's Pc has a nice gui for his apache
> setup.. mine doesnt..*
> I tried looking on Apache's site for how to configure it, but it was
> highly confusing.  When it asks for a virtual host name, I'm giving the
> IP I want it to look for, and then it'll ask for the server name,and
> I'll just put something Imade up, like cheese.org or something.. If I
> use the IP, I get to it, (it gives me a forbidden error though, which
> wil be my next thing to check into), but if I use the www.cheese.tld
> that I hvave set up, it says Unknown Host...  anyone able to help me
> with this?  Is it just because I used a bogus ending, like tld?
> 
>   thanks, 
>     mea
> 
> _______________________________________________
> Techtalk mailing list
> Techtalk at linuxchix.org
> http://www.linuxchix.org/mailman/listinfo/techtalk
> 





More information about the Techtalk mailing list