LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 09-13-2004, 02:10 PM   #1
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Rep: Reputation: 15
Apache Virtual Hosts


This is killing me. I have tried reading everything I can find about setting up virtual hosts in Apache. I currently host about ten different sites on a windows machine. I am trying as hard as I can to switch to Linux but I am stumbling on this one.

I have Suse 9.1 professional, Red Hat 9.0, Mandrake 9.2 and 8.1, Fedora 2, and Xandros, to choose from. I lost my Debien disks when I lent them out and I haven't replaced them yet, I have replaced the from though.

I have use Webmin, and redhats gui for this and I just cannot seem to be successful.

I read all the forums that I can find on this and they're answers are either too technical for me still or a different distribution or something just way out there.

I am begging, please will someone tell me which distribution to use, and give me real life examples on how to set this up. Please use "See Spot Run Language".

Thanx for the help. I am sure this is something you guys do in your sleep, but I have been known to load three or four distributions in a day trying different combinations of information I have read or been told. Please help a guy out.
 
Old 09-13-2004, 02:30 PM   #2
codecruncher
Member
 
Registered: Aug 2003
Location: Austria
Distribution: Fedora Core release 2 (Tettnang)
Posts: 37

Rep: Reputation: 15
I do recommend Whitebox Enterprise Linux since it is the same as RedHat Enterprise server 3.0 just without the copyrighted stuff from RedHat.

Setting up Virtual Hosts is quite easy. Just edit /etc/http/conf/httpd.conf. At the very bottom you'll find the following:
#
# Use name-based virtual hosting.
#
#NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>



Simply add the folowing:

NameVirtualHost 213.147.164.xxx

<VirtualHost 213.147.164.xxx>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/wwwhtdocs.404/
ServerName 404.yourdomain.com
</VirtualHost>

<VirtualHost 213.147.164.xxx>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/htdocs.shop_inet/
ServerName shop.yourdomain.com
</VirtualHost>

and so on...

HTH
Klaus

btw: This should work in every distro. This Apache specific - not Linux specific (meaning also works in Windows)
 
Old 09-13-2004, 04:06 PM   #3
Pete M
Member
 
Registered: Aug 2003
Location: UK
Distribution: Redhat 9 FC 3 SUSE 9.2 SUSE 9.3 Gentoo 2005.0 Debian Sid
Posts: 657

Rep: Reputation: 30
dienerk, Klaus

Just to add a little something, be aware of this statement in httpd.conf

<Directory />
Order Deny,Allow
Deny from all
</Directory>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

Which by default denies Apache access to all directories unless you specifically allow it

So
<VirtualHost 213.147.164.xxx>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/wwwhtdocs.404/
ServerName 404.yourdomain.com
</VirtualHost>

<VirtualHost 213.147.164.xxx>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/htdocs.shop_inet/
ServerName shop.yourdomain.com
</VirtualHost>

Needs to be
<VirtualHost 213.147.164.xxx>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/htdocs.404/
ServerName 404.yourdomain.com
<Directory "var/www/htdocs.404">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 213.147.164.xxx>
ServerAdmin webmaster@yourdomain.com
DocumentRoot /var/www/htdocs.shop_inet/
ServerName shop.yourdomain.com
<Directory "var/www/htdocs.shop_inet">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

May help, took me a long time to work out my own Virtual Hosts

Pete
 
Old 09-13-2004, 08:43 PM   #4
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Original Poster
Rep: Reputation: 15
Thank you very much for the tips, I will try them both. I appreciate your valuable time for helping a newbie.
 
Old 09-14-2004, 04:22 PM   #5
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Original Poster
Rep: Reputation: 15
You know I feel pretty stupid, but I could not get the suggestions to work. I am taking yor advise and getting the White Box Enterprise distribution. I should be done downloading it in an hour.

Is there any way I could get a copy of a complete http.conf file with virtual hosts that works so I could have an entire working model? I believe it would be easier for me to grasp something that I already know works. I have noticed advise I have received in the past may not be good and that may be part of my problem.

I hope someone can help. Thanx again for your time and trouble.
 
Old 09-14-2004, 05:16 PM   #6
Pete M
Member
 
Registered: Aug 2003
Location: UK
Distribution: Redhat 9 FC 3 SUSE 9.2 SUSE 9.3 Gentoo 2005.0 Debian Sid
Posts: 657

Rep: Reputation: 30
dienerk

I'm no httpd expert but I do know there are many variations of Apache so sending you a httpd.conf is doomed to fail

As you are downloading White Box Enterprise why not do a fresh install of Apache and start from scratch, in fact it probably comes as a default package

First piece of advise is make a copy of httpd.conf before you do anything this way you have something to fall back on, it's real easy to do, simply navigate to your /etc/httpd/conf directory and enter 'cp httpd.conf httpd.save' you now have an intact file called httpd.save should you need it

Secondly get your hands dirty on the command line when editing the file never had much success with GUI's plus you will learn a lot more about the inner workings of Apache

I know this is not the solution you are looking for but at least with Linux it only costs you time not money

Pete
 
Old 09-14-2004, 06:56 PM   #7
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Original Poster
Rep: Reputation: 15
Thanx for the advise Pete. I will try it in the next day or two. I will try the command line idea. That seems to be the key in learning more about linux and how it works.

Thanx for your time.
 
Old 09-14-2004, 09:15 PM   #8
Dunga Bee
LQ Newbie
 
Registered: Sep 2004
Posts: 11

Rep: Reputation: 0
Once you set some Name Virtual Hosts up, you should be able to test the config and see how it interprets your virt hosts by using a switch on the apache exe. I can't remember the exact switch now, but check the help on the apache command and it should say. I've found that to show me things I may never have thought of.

Good luck!
 
Old 09-15-2004, 08:28 AM   #9
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Original Poster
Rep: Reputation: 15
Apache Virtual Host Dungeon!

I GIVE UP! APACHE WINS!
Below is a copy of my http.conf file. Can anyone tell me why this is not working?

Now I get an error that say" httpd failed. Starting httpd: (99) Cannot assign requested address: make_sock: could not bind to address 24.173.163.190:80 No listening sockets available, shutting down Unable to open logs! (Then I think I hear the machine laughing at me.)

How can apache be the most popular server on the internet when it is this difficult to setup? I tried reading the apache site again last night and still don't understand where I am going wrong.

Is ther anyone I can e-mail my httpd file to and they can have a look? I am blind at this moment.

ALL HELP IS APPRECIATED!!!!!!!!!
 
Old 09-15-2004, 08:33 AM   #10
Dunga Bee
LQ Newbie
 
Registered: Sep 2004
Posts: 11

Rep: Reputation: 0
Post your config here and we can take a look.
 
Old 09-15-2004, 11:12 AM   #11
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Original Poster
Rep: Reputation: 15
I tried first, but it said that it was too many characters. How much of the config to you need. Or should I edit out all of the lines with "#"? Suggestions?

does this much help?

#
# Use name-based virtual hosting.
#
NameVirtualHost 24.173.163.190:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost 24.173.163.190:80>
ServerAdmin linux@medscribe.biz
DocumentRoot /var/www/naghag.com/
ServerName naghag.com
</VirtualHost>

<VirtualHost 24.173.163.190:80>
ServerAdmin linux@medscribe.biz
DocumentRoot /var/www/medscribe.biz/
ServerName medscribe.biz
</VirtualHost>

<VirtualHost 24.173.163.190:80>
ServerAdmin linux@medscribe.biz
DocumentRoot /var/www/pandagirl.us/
ServerName pandagirl.us
</VirtualHost>

Last edited by dienerk; 09-15-2004 at 11:13 AM.
 
Old 09-15-2004, 12:00 PM   #12
Pete M
Member
 
Registered: Aug 2003
Location: UK
Distribution: Redhat 9 FC 3 SUSE 9.2 SUSE 9.3 Gentoo 2005.0 Debian Sid
Posts: 657

Rep: Reputation: 30
dienerk

To keep it simple (KIS) find this statement in httpd.conf

# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
Listen 80

Use 'Listen 80' just to get Apache started we'll be more specific later, no ' : ' needed

Again KIS change your virtual host statements to read

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost *:80>
ServerAdmin linux@medscribe.biz
DocumentRoot /var/www/naghag.com/
ServerName naghag.com
</VirtualHost>

<VirtualHost *:80>
ServerAdmin linux@medscribe.biz
DocumentRoot /var/www/medscribe.biz/
ServerName medscribe.biz
</VirtualHost>

<VirtualHost *:80>
ServerAdmin linux@medscribe.biz
DocumentRoot /var/www/pandagirl.us/
ServerName pandagirl.us
</VirtualHost>

Did you remember about this statement

# First, we configure the "default" to be a very restrictive set of
# features.
<Directory />
Order Deny,Allow
Deny from all
</Directory>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

If it looks like this then you will have to give Apache specific instructions in each VirtualHost to allow access to the DocumentRoot

Are the directories naghag.com, medscribe.biz, pandagirl.us world readable ? if not you will have to change the permissions

Do you have a Main server configuration ? if so you should also add this as a VirtualHost

Think that's enough for you to get on with

Pete
 
Old 09-15-2004, 02:19 PM   #13
dienerk
Member
 
Registered: Feb 2004
Location: Ocala, Florida
Distribution: Suse 9.1 Pro, Redhat 9, Mandrake 9.2 & 8.1, Fedora 2, and White Board
Posts: 54

Original Poster
Rep: Reputation: 15
Thanks for the Info. My wife is going into labor so it may be a little while before I can try this. I appreciate the help. My daughter should be here tonight or tomorrow.

Thanx again.
 
Old 09-15-2004, 02:21 PM   #14
Dunga Bee
LQ Newbie
 
Registered: Sep 2004
Posts: 11

Rep: Reputation: 0
Congrats!
 
Old 09-15-2004, 02:25 PM   #15
Pete M
Member
 
Registered: Aug 2003
Location: UK
Distribution: Redhat 9 FC 3 SUSE 9.2 SUSE 9.3 Gentoo 2005.0 Debian Sid
Posts: 657

Rep: Reputation: 30
dienerk

I think it's time for Apache to take a back seat, hope your wife and soon to be daughter are both OK

Just post back whenever you are ready

Regards

Pete
 
  


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are 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 06:29 AM
Apache/Virtual Hosts Help C-Squared Linux - General 9 08-04-2003 12:45 PM
Apache Virtual Hosts (again) scatcat Linux - General 1 10-17-2002 09:51 AM
Apache: Virtual hosts pk21 Linux - Software 15 10-08-2002 05:08 PM
apache virtual hosts jonfa Linux - General 1 06-04-2002 01:50 AM


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

Main Menu
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