Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Fedora This forum is for the discussion of the Fedora Project.


  Search this Thread
Old 04-03-2006, 05:04 AM   #1
LQ Newbie
Registered: Apr 2006
Posts: 1

Rep: Reputation: 0
virtual hosts problem - fedora core 4


i want to setup some virtual hosts on fedora (core 4), when i add the first host in httpd.conf localhost will go in the directory of my first virtual host (site1), same as the second host (site2)

what's the problem in the following lines

<VirtualHost *:80>
DocumentRoot var/www/html/site1
ServerName wwwsite1com (i cannot post links (

<VirtualHost *:80>
DocumentRoot var/www/html/site2
ServerName wwwsite2com (same here (

i already setup site1 and 2 in /etc/hosts

Thank you.
Old 04-04-2006, 01:28 AM   #2
Senior Member
Registered: Oct 2003
Location: /earth/usa/nj (UTC-5)
Distribution: RHL9;F1-10; CentOS4-5; DebianSarge-Squeeze
Posts: 1,151

Rep: Reputation: 46
Didn’t understand the question, but I think you are probably puzzled by why all calls for localhost only load the first virtual host.

The first virtual host is the default for any requests that do not match subsequent virtual hosts’ ServerName or ServerAlias. Although most people usually define the ServerName for the first virtual host, you really don’t even need a ServerName for the first virtual host.

Since “localhost” does not match the second virtual host ServerName, then the default when you call for localhost is to load the first virtual host. You can use a ServerAlias alone or in combination with different ports to locally distinguish between the two sites.

For example, ServerAlias for the second virtual host could be defined as the LAN ip address of the system. Any local call to the LAN ip address would select the second virtual host, whereas localhost would default to the first virtual host.

Also, you should use a DirectoryIndex for each virtual host.


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
Postfix + Virtual Hosts Problem vbfischer Linux - Networking 1 03-30-2005 09:42 PM
virtual hosts problem newuser455 Linux - Software 0 08-29-2004 09:01 PM
Java Virtual Machine on Fedora Core 2 sonesay Fedora 3 06-06-2004 08:14 AM
IP based virtual hosts problem adm1329 Linux - Networking 4 03-11-2004 11:40 AM
Problem with Apache Virtual Hosts jaberwooky Linux - Software 4 09-23-2003 02:37 PM > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 11:50 AM.

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