LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-31-2005, 12:29 PM   #1
nr5
Member
 
Registered: Dec 2004
Posts: 65

Rep: Reputation: 15
Unhappy Virtual Hosting?


Hello,

Just about to set up two websites on my new server, but im new to setting up virtual hosts so i need help...

Lets say my real IP address is 123.4.5.6 and that im running my first website on it. Now the problem comes with my second website and second IP. Look at this

<VirtualHost 123.4.5.7>
ServerAdmin admin@mysite.com
DocumentRoot /home/mysite/public_html
ServerName www.mysite.com
ErrorLog /home/mysite/logs/error_log
CustomLog /home/mysite/logs/access_log common
</VirtualHost>

Notice that i increased 6 to 7 at the end of the IP address... Can I do this??? what if someone else has that IP address??? Can someone else have that IP address??

Using the example above every time I try to access the second website typing http://123.4.5.7/ in the browser I get "This document contains no data" as an error..... and then blank page...

Accessing my first site on http://123.4.5.6/ is no problem....
I placed an test index.html file in /home/mysite/public_html just in case but i still get the same result

Anyone know how to solve this?

Thank you.
 
Old 05-31-2005, 12:34 PM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
no, you can't change the IP like that unless both IP's point to your server, for each virtualhost just set 'ServerName' to the domain, so for one it may be www.domain1.com and the second virtualhost may have ServerName set to www.domain2.com
 
Old 05-31-2005, 12:47 PM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
If your sites are on the same server.. don't even bother with specifying the IP address in the Virtual hosts section..

<VirtualHost *> <= should work just fine and to clarify, no you can't just make up IP addresses..
 
Old 05-31-2005, 01:33 PM   #4
nr5
Member
 
Registered: Dec 2004
Posts: 65

Original Poster
Rep: Reputation: 15
Okay, this is how i did it now:

<VirtualHost 123.4.5.6>
ServerAdmin admin@mysite1.com
DocumentRoot /home/mysite1/public_html
ServerName www.mysite1.com
ErrorLog /home/mysite1/logs/error_log
CustomLog /home/mysite1/logs/access_log common
</VirtualHost>

<VirtualHost 123.4.5.6>
ServerAdmin admin@mysite2.com
DocumentRoot /home/mysite2/public_html
ServerName www.mysite2.com
ErrorLog /home/mysite2/logs/error_log
CustomLog /home/mysite2/logs/access_log common
</VirtualHost>

But i get this warning after restarting the server:

Stopping httpd: [ OK ]
Starting httpd: [Tue May 31 20:19:13 2005] [warn] VirtualHost 123.4.5.6:0 overlaps with VirtualHost 123.4.5.6:0, the first has precedence, perhaps you need a NameVirtualHost directive
[ OK ]

Not sure what that means?? What do I do??

Thx
 
Old 05-31-2005, 03:26 PM   #5
jonlake
Member
 
Registered: Apr 2004
Distribution: Slackware 11.0, Gentoo
Posts: 252

Rep: Reputation: 31
Get rid of the IP address and use a *
 
Old 05-31-2005, 03:58 PM   #6
nr5
Member
 
Registered: Dec 2004
Posts: 65

Original Poster
Rep: Reputation: 15
ah okay, i have been reading alot and found out that Virtual Hosting needs separate IP addresses for each website... and since I only have one address I need to create my own virtual IP adresses (IP aliace)........ In that case, replacing the IP as some of you mention above with a * wont to the job will it??

I did replace it with a * and got the same warning message as I explained above....

Does anyone know how to make virtual IP adresses?? I tried to find a Fedora documentation but failed doing so...
 
Old 05-31-2005, 04:07 PM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Ok, stop worrying about having additional IP's or virtual IP's.. etc..

Try doing this instead:

<VirtualHost *:80>

And did you actually test your sites despite that error?
 
Old 05-31-2005, 04:35 PM   #8
Baltasar
Member
 
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43

Rep: Reputation: 15
If you have one 1IP and want to run more than one website you must use name-based virtual hosts.
you should read the following links

http://httpd.apache.org/docs-2.0/en/vhosts/
http://httpd.apache.org/docs-2.0/en/...ame-based.html
http://httpd.apache.org/docs-2.0/en/.../examples.html
http://httpd.apache.org/docs-2.0/en/.../ip-based.html
 
Old 05-31-2005, 05:21 PM   #9
PFudd
LQ Newbie
 
Registered: Mar 2004
Posts: 17

Rep: Reputation: 2
Add 'NameVirtualhost 123.4.5.6' to httpd.conf.

It just means 'Requests to this ip address will be categorized by the hostname they ask for'.

You can have a million web sites on a single ip address, as long as their names are different. The names need to be put into dns, or into the 'hosts' file on the client's computer, or else the client won't know what ip address to go to.
 
Old 06-02-2005, 10:43 AM   #10
nr5
Member
 
Registered: Dec 2004
Posts: 65

Original Poster
Rep: Reputation: 15
Okay, I basically got it all figured out now, just have a few more questions:

Using IP-based hosting, I can only, and I mean ONLY run ONE website under one IP address correct?

IF I can run more then ONE website on an IP-based hosting, please explain HOW

I choose to use IP-based hosting because I need the SSL later... so I wont be using Name-based hosting...

Thx
 
Old 06-03-2005, 01:30 PM   #11
Baltasar
Member
 
Registered: Jan 2004
Distribution: Fedora & Debian
Posts: 43

Rep: Reputation: 15
For each IP-based virtual host you need one IP and there can be only one web. It is also not possible to use Name-Based Virtual Hosting to identify different SSL virtual hosts. You must use for every SSL site with his own certificate a new IP-based virtual host (or a different Port). Have a look at http://httpd.apache.org/docs-2.0/ssl...q.html#vhosts2

Last edited by Baltasar; 06-03-2005 at 01:35 PM.
 
  


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
virtual hosting setenv02 Linux - General 6 05-05-2005 02:35 AM
Virtual hosting... id10t Linux - Networking 4 02-02-2004 05:43 PM
Virtual Hosting - what does it actually do? gevers1 Linux - General 3 02-01-2004 09:28 AM
Virtual Hosting joseph Linux - General 3 08-20-2003 04:16 AM
Virtual Hosting marson Linux - General 2 12-28-2000 08:14 PM


All times are GMT -5. The time now is 02:28 PM.

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