LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 03-12-2004, 07:54 AM   #1
jme
Member
 
Registered: Sep 2003
Location: Cardiff, UK
Distribution: Debian
Posts: 49

Rep: Reputation: 15
Apache configuration error - virtual hosts


Hiya guys,

I have finally installed apache, php & mysql on my server running Debian 3.0r1 and got one of my sites transfered across from some other hosting that I used.

Anyway, this morning came the time to set up the virtual hosts so that I can have my other two websites working from the same server..I have read a few howtos, and I think that I have done everything okay, but I still cannot access the second site.

I have moved my first site into a new directory, and set up another directory in the www directory for the two sites, so I have the followong:

Code:
 /var/www/siteone.com/
Code:
 /var/www/sitetwo.com/
I have set these as the root directories of the sites, but if I go to www.siteone.com everything works fine, however if I go to www.sitetwo.com, I still get the first site, not the second site in /var/www/sitetwo.com.

I have smoothwall acting as a rounter which port forwards anything on port 80 through to my server - I know this was working as I had the one site running on it yesterday.

Anyway, here is my httpd.conf file for the virtual hosts:

Code:
### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them.
# Please see the documentation at 
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# If you want to use name-based virtual hosts you need to define at
# least one IP address (and port number) for them.
#
NameVirtualHost 192.168.1.200:80
#NameVirtualHost 12.3.34.34

NameVirtualHost *:80

<VirtualHost *:80>
ServerName siteone.com
DocumentRoot /var/www/siteone.com/
</VirtualHost>

<VirtualHost *:80>
ServerName sitetwo.com
DocumentRoot /var/www/sitetwo.com/
Any help would be greaetly apreciated.

Jamie
 
Old 03-12-2004, 07:59 AM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
try this

#NameVirtualHost 192.168.1.200:80
#NameVirtualHost 12.3.34.34

NameVirtualHost *

<VirtualHost *:80>
ServerName www.siteone.com
DocumentRoot /var/www/siteone.com/
</VirtualHost>

<VirtualHost *:80>
ServerName www.sitetwo.com
DocumentRoot /var/www/sitetwo.com/
 
Old 03-12-2004, 08:20 AM   #3
jme
Member
 
Registered: Sep 2003
Location: Cardiff, UK
Distribution: Debian
Posts: 49

Original Poster
Rep: Reputation: 15
Just tried that but now I cannot get to either of the sites. When I point the browser at the two addresses I get:

"The connection was refused when attempting to contact sitetwo.com"

Thanks for the quick reply.

Jamie
 
Old 03-12-2004, 09:49 AM   #4
member57
Member
 
Registered: Jul 2003
Location: Texas
Distribution: Mandrake
Posts: 65

Rep: Reputation: 15
I think you need to set permissions through apache,
allow from all
I don't know if that will help or not.
 
Old 03-12-2004, 07:27 PM   #5
tuxguy
Member
 
Registered: Mar 2004
Location: North Bay, Ontario - CANADA
Distribution: Debian
Posts: 77

Rep: Reputation: 15
Definatly comment out your first NameVirtualHost with the 192.* IP in it...


then try this:

NameVirtualHost *

<VirtualHost *>
ServerName www.siteone.com
ServerAlias siteone.com
DocumentRoot /var/www/siteone.com
</VirtualHost>

<VirtualHost *>
ServerName www.sitetwo.com
ServerAlias sitetwo.com
DocumentRoot /var/www/sitetwo.com
</VirtualHost>

small thing but if you take the last / off the DocRoot.... makes a big diff...
I got mine going with the above code...
these are on the same server...

site one

site two

Jesse

Last edited by tuxguy; 03-12-2004 at 08:31 PM.
 
Old 03-14-2004, 02:17 PM   #6
jme
Member
 
Registered: Sep 2003
Location: Cardiff, UK
Distribution: Debian
Posts: 49

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by tuxguy
Definatly comment out your first NameVirtualHost with the 192.* IP in it...


then try this:

NameVirtualHost *

<VirtualHost *>
ServerName www.siteone.com
ServerAlias siteone.com
DocumentRoot /var/www/siteone.com
</VirtualHost>

<VirtualHost *>
ServerName www.sitetwo.com
ServerAlias sitetwo.com
DocumentRoot /var/www/sitetwo.com
</VirtualHost>

Jesse
Jesse, thanks for your reply... I used the same code as you have above, but I still have problems....

I can now get the server working, but if you go to www.siteone.com you see the correct details - ie. site one's site; but if you go to www.sitetwo.com you still get site ones data, not the site that is contained in /var/www/sitetwo.

Any ideas??

Thanks for your help.

Jamie
 
Old 03-15-2004, 12:56 AM   #7
tuxguy
Member
 
Registered: Mar 2004
Location: North Bay, Ontario - CANADA
Distribution: Debian
Posts: 77

Rep: Reputation: 15
Jamie... I dont... I just clicked on your links in your post...

siteone = "start your webtravels here" graphic center page..
site two = "www.sitetwo.com is for possible sale
Call ......."
try refreshing your browser..

Last edited by tuxguy; 03-15-2004 at 12:57 AM.
 
Old 03-15-2004, 07:17 AM   #8
jme
Member
 
Registered: Sep 2003
Location: Cardiff, UK
Distribution: Debian
Posts: 49

Original Poster
Rep: Reputation: 15
Sorry, my there not my domain names, I was just using them as examples for the post.

Didn't even realise that there were sites with those domain names!

My domain names are:
www.jamiedavies.org which forwards to a no-ip address to enable me to run a webserver with my dynamic ip, and the otherone is www.beanedandtoasted.com, again forwarding to a no-ip address.

www.jamiedavies.org >> www.jamiedavies.no-ip.org >> my webserver
www.beanedandtoasted.com >> www.beanedandtoasted.no-ip.com >> my webserver

Sorry about the confusion.

EDIT: I know that the Beanedandtoasted.com address is working at the moment but that is because I need to have it up and running and it is hosted on another server at the moment! Just to confurse you all more!!

Cheers,
Jamie

Last edited by jme; 03-15-2004 at 07:19 AM.
 
Old 03-15-2004, 09:13 AM   #9
jme
Member
 
Registered: Sep 2003
Location: Cardiff, UK
Distribution: Debian
Posts: 49

Original Poster
Rep: Reputation: 15
Jesse,

Thanks so much for your help - after a bit of tinkering around I have managed to get everything working just as I like it! My little webserver is now just sat in the corner puring away.

All the best.

Jamie
 
  


Reply


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
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 07:29 AM
apache virtual hosts smaida Linux - Software 3 06-20-2004 05:28 PM
apache virtual hosts Red Squirrel Linux - Software 4 06-20-2004 10:05 AM
Apache Virtual Hosts (again) scatcat Linux - General 1 10-17-2002 10:51 AM
apache virtual hosts jonfa Linux - General 1 06-04-2002 02:50 AM


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

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