Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 10-31-2003, 08:25 AM   #1
LQ Newbie
Registered: Oct 2003
Posts: 2

Rep: Reputation: 0
apache virtual host problem - webmin


I set up additional virtual hosts on my machine through webmin apache but the default domain name points to the first virtual host. Do I have to set up a default virtual host and point it to the default directory or is there an error happening.

Thanks Reed
Old 10-31-2003, 10:01 AM   #2
LQ Newbie
Registered: Oct 2003
Location: Norway
Distribution: 98SE, 2000, MS-DOS6.22, Trustix1.5, Slackware 9.1
Posts: 23

Rep: Reputation: 15

I'm trying to learn apache myself, but haven't tried the 'virtual host' settings. I sorta did it the easy way by creating symlinks from the doc root dir to the various users dir. Dunno if there are security issues against doing it this way, but i found it pretty easy

In my server doc root dir ( /www/html ) i made the symlinks like:

ln -s /home/user1/html user1

This makes a symlink called 'user1' that points to user1's html directory. The url would then be:
Old 11-01-2003, 12:24 PM   #3
bobby sands
LQ Newbie
Registered: Nov 2003
Posts: 1

Rep: Reputation: 0
hi- i'm having exactly the same problem. i have set up a number of virtual hosts, restarted apachectl etc. etc. and nothing happens- every domain points to the default virtual host. Here are the details from the httpd.conf file:

NameServer (an ip address)

and each virtual host takes the form:

DocumentRoot /usr/local/apache/htdocs/xxxxxx
ServerAlias *
ErrorLog logs/
CustomLog logs/ common

do i have to use the gateway IP address of the machine or something?

also- does it matter that the domain(s) pointing to the machine are pointing to an ip address rather than a name.

it is getting supa frustrating now!

cheers for listening- hope someone answers...
Old 11-07-2003, 12:09 PM   #4
LQ Newbie
Registered: Oct 2003
Location: Norway
Distribution: 98SE, 2000, MS-DOS6.22, Trustix1.5, Slackware 9.1
Posts: 23

Rep: Reputation: 15
As i'm pretty new to apache myself, i'm not sure this will help, but... I believe i read an example file on virtual severs somewhere, and as i remember it each virtual server was given a different port. Something like <VirtualHost 1st.server.ip.adr:8001>
<VirtualHost 2nd.server.ip.adr:8002>

Dunno if this helps, just a thought
Old 11-08-2003, 12:52 AM   #5
Registered: Dec 2002
Location: California
Distribution: Slackware & LFS
Posts: 799

Rep: Reputation: 33
reedsmith: Yes, you must set up a default VirtualHost. Any domain name that resolves to your IP and is not listed in a VirtualHost directive will default to the first one listed. This caused me some embarassment when I was hosting a small business and when my client left the www off of his URL, it defaulted to the first VH on my server, which happened to be a porno site! (Which is why you want to add ServerAlias * to each VH directive)

From the Apache docs:
For example, suppose that you are serving the domain www.domain.tld and you
wish to add the virtual host www.otherdomain.tld, which points at the same IP
address. Then you simply add the following to httpd.conf:

    NameVirtualHost *

    <VirtualHost *>
    ServerName www.domain.tld
    DocumentRoot /www/domain

    <VirtualHost *>
    ServerName www.otherdomain.tld
    DocumentRoot /www/otherdomain
phz: First off, unless you have a specific reason for assigning other ports, don't do it. It'll only make it harder to reach your site if everyone has to append a port number to your URL.

Secondly, if you rename the /home/user1/html directory to /home/user1/public_html, then apache will serve the pages there to the URL So you don't need the symlinks.

[edit] Or you can change the following section in httpd.conf:
<IfModule mod_userdir.c>
    UserDir public_html
<IfModule mod_userdir.c>
    UserDir html

bobby sands: I think you need to use the 'NameVirtualHost *' (or 'NameVirtualHost') directive, not NameServer

--- Cerbere

Last edited by Cerbere; 11-08-2003 at 12:59 AM.
Old 11-08-2003, 08:02 AM   #6
LQ Newbie
Registered: Oct 2003
Location: Norway
Distribution: 98SE, 2000, MS-DOS6.22, Trustix1.5, Slackware 9.1
Posts: 23

Rep: Reputation: 15
Thanx for the info - it really made a few things a bit clearer to me All those docs & howto's really can be an information overdose to us not so experienced with linux/apache...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Virtual Host Problem eckertc1 Linux - Newbie 11 03-23-2005 03:31 PM
Apache Virtual Host problem Seventh Linux - Software 2 03-19-2005 06:33 PM
Apache and Virtual Host Problem sekondborn Linux - Software 9 02-12-2005 02:26 PM
Apache virtual host problem Adrohak Linux - Software 3 07-18-2004 04:17 PM
Virtual Host Problem using Apache ataber Linux - Newbie 2 01-27-2003 12:32 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration