LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices

Reply
 
Search this Thread
Old 10-19-2006, 06:20 AM   #1
frankkky
Member
 
Registered: Sep 2006
Posts: 52

Rep: Reputation: 15
Can't connect to Virtual Host in Apache


after setting up apache on Enterprise Linux (CentOS). i configured 2 additional virtual hosts (name based virtual hosts) - vh1 and vh2 which is in addition to the default virtual host. (total of 3). all in one ip addresse. now in the document root directory i further created sub folders for the 3 virtual hosts and dumped seperate html files on them.
but the problem is that during test, from my browser i can only access the default virtual host. the other two remains unreachable.
i'm suspecting port mapping 'cos the default virtual host is mapped to port 80 and the other two are mapped to port 7040 and 7045. now in the HTTP configuration window->Main tab, if i add additional ports, when i want to restart the httpd service it will fail; displaying an error and refering me to the additional added ports.

the question is how do i simply get additional (name based) virtual host well configured up and running?
 
Old 10-19-2006, 06:22 AM   #2
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Why are you port mapping? You can run the virual hosts off of 80 as well.
 
Old 10-19-2006, 12:44 PM   #3
frankkky
Member
 
Registered: Sep 2006
Posts: 52

Original Poster
Rep: Reputation: 15
thanks for your advice. i tried it but the thing is that in the html document folders of these virtual hosts i have simple web site i dump inside each of them. (index1.html, index2.html and index3.html respectively). so when i run the test on my browser for example:
HOSTNAME/index1.html (which is the default virtual host)
i hit it succesfully. But when i enter:
HOSTNAME/index2.html or HOSTNAME/index3.html
an error comes up saying: "The requested URL /index2.html was not found on this server"
i've tried all i can i just cannot get to the second and third virtual hosts from my browser.
whats the way out?
 
Old 10-19-2006, 04:27 PM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I'll ask again - why are you port mapping rather than using the default port 80? I've run a couple of virtual hosts, similar to what you describe without resorting to odd ports
 
Old 10-20-2006, 08:39 AM   #5
Jaqui
Member
 
Registered: Jan 2006
Location: Vancouver BC
Distribution: LFS, SLak, Gentoo, Debian
Posts: 291

Rep: Reputation: 36
frankkky,
billymayday is right, you do not need to use the other ports, the virtual hosts will all work on port 80.

There is only one reason to use port mapping for virtual hosts, that is to enable ssl certificates for the hosted domains, when you only have one ip address available.
[ ssl is ip based, not name based, so ports will enable domain specific certificates with only one ip ]
 
Old 10-20-2006, 11:40 AM   #6
frankkky
Member
 
Registered: Sep 2006
Posts: 52

Original Poster
Rep: Reputation: 15
yeah Billymayday, sorry i forgot to tell you that i've alredy followed your instruction and set all the ports to port 80 (this is even before my second post). still the problem is not solved.
i even took further steps; now to configure only the default port to port:80 and left the additoinal vh1 and vh2 with no port numbers. still the problem remains.
 
Old 10-20-2006, 11:56 AM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by frankkky
yeah Billymayday, sorry i forgot to tell you that i've alredy followed your instruction and set all the ports to port 80 (this is even before my second post). still the problem is not solved.
i even took further steps; now to configure only the default port to port:80 and left the additoinal vh1 and vh2 with no port numbers. still the problem remains.
Well if you wanted the other virtual hosts on different ports, did you specify Apache to listen on those ports?

Can you post an example output of your virtual host setup/config here?
 
Old 10-20-2006, 01:52 PM   #8
frankkky
Member
 
Registered: Sep 2006
Posts: 52

Original Poster
Rep: Reputation: 15
yes trickykid, i tried to specify apache to listen to other ports. but the problem is that after adding additinal ports, when i try to restart http deamon it will fail to start, will come up with error message refering me to the additoinal ports i added (just as i mentioned in my first post) and when i go back and remove those ports it can now be restarted.
please note that i did all my configuration via the HTTP graphic interface tool, not the ../httpd.conf file.
ok. below is the my configuration as it appeared in the ../httpd.conf file (the Vitual Host Section):

Listen *:80
ServerName www.myweb.com
UseCanonicalName on
# Use name-based virtual hosting.
NameVirtualHost 192.168.1.10

# Where do we put the lock and pif files?
LockFile "/var/lock/httpd.lock"
CoreDumpDirectory "/etc/httpd"

# Defaults for virtual hosts
# Logs
# Virtual hosts
# Virtual host Default Virtual Host
<VirtualHost 192.168.1.10>
DocumentRoot /var/www/html/vfile1/
ServerAdmin webmaster@myweb.com
ServerName www.myweb.com
ServerAlias myweb.com
ServerAlias *.myweb.com
DirectoryIndex index.php index1.html index.htm index.shtml
LogLevel debug
HostNameLookups off
</VirtualHost>

# Virtual host myweb2.com
<VirtualHost 192.168.1.10>
DocumentRoot /var/www/html/vfile2/
ServerAdmin webmaster@myweb2.com
ServerName www.myweb.com
ServerAlias myweb2.com
ServerAlias *.myweb2.com
DirectoryIndex index2.html index.htm index.shtml
</VirtualHost>

# Virtual host myweb3.com
<VirtualHost 192.168.1.10>
DocumentRoot /var/www/html/vfile3/
ServerAdmin webmaster@myweb3.com
ServerName www.myweb3.com
ServerAlias myweb3.com
ServerAlias *.myweb3.com
DirectoryIndex index3.html index.htm index.shtml
</VirtualHost>
 
Old 10-20-2006, 02:42 PM   #9
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
If you don't have more than one IP listening on any device or multiple devices listening, try changing:

Code:
NameVirtualHost 192.168.1.10
To:

Code:
NameVirtualHost *:80
And you can change this:

Code:
<VirtualHost 192.168.1.10>
To:

Code:
<VirtualHost *>
Make changes, run configtest, restart if no errors.
 
Old 10-20-2006, 04:16 PM   #10
rakesh_jims
LQ Newbie
 
Registered: Oct 2006
Posts: 5

Rep: Reputation: 0
hi i am rakesh
i use linux 9. i want to share bandwidth.it possible or not
i have two wan. i want to combined banwidth with use local network
or
if one one wan is down then other wan is activited.
how i can do.
please write us
thank
 
Old 10-21-2006, 04:38 AM   #11
frankkky
Member
 
Registered: Sep 2006
Posts: 52

Original Poster
Rep: Reputation: 15
hey Rakesh please open a new tread for your topic. i dont want you to divert attention from mine.

yeah trickykid, you see; i did exactly what you say but i still cant reach vhost2 and vhost3. it happens that if i assign ip address with or without port number to vhost1 then i can only see vhost1 on the browser and never others.
if i do so to vhost2 i will only see vhost2 on the browser and never others.
the same happens on vhost3.
but then if i assign ip address or asterisk (*) to all of them with or with out port number. i can only see the first vhost and never others.
the way out please?
 
Old 10-21-2006, 05:33 AM   #12
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Rakesh, Frank is spot on. Start a new thread.

Frank, post the VirualHost settings from your httpd.conf
 
Old 10-21-2006, 10:28 AM   #13
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by rakesh_jims
hi i am rakesh
i use linux 9. i want to share bandwidth.it possible or not
i have two wan. i want to combined banwidth with use local network
or
if one one wan is down then other wan is activited.
how i can do.
please write us
thank
rakesh_jims,

You have been previously warned about hijacking threads. If you continue to hijack threads that have nothing to do with your questions, you will lose privleges to this site. If you have any questions or comments, contact the forum administrator. So I'd like to ask you once again, start your own "New Thread" for your own question and stop clicking the "Reply" opn threads that don't even relate to your question. Abuse it and you'll lose it!

Quote:
Originally Posted by billmayday
Frank, post the VirualHost settings from your httpd.conf
He already posted his virtual host settings from his httpd.conf
 
Old 10-21-2006, 10:29 AM   #14
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by frankkky
hey Rakesh please open a new tread for your topic. i dont want you to divert attention from mine.

yeah trickykid, you see; i did exactly what you say but i still cant reach vhost2 and vhost3. it happens that if i assign ip address with or without port number to vhost1 then i can only see vhost1 on the browser and never others.
if i do so to vhost2 i will only see vhost2 on the browser and never others.
the same happens on vhost3.
but then if i assign ip address or asterisk (*) to all of them with or with out port number. i can only see the first vhost and never others.
the way out please?
And I'm assuming you have proper DNS setup/configurations for these other virtual hosts?
 
Old 10-21-2006, 01:15 PM   #15
frankkky
Member
 
Registered: Sep 2006
Posts: 52

Original Poster
Rep: Reputation: 15
please kindly explain to me how to go about the DNS configuration in this scenerio, i've heard that DNS should come into play here, but how? please explain to me.
by the way i have DNS service running in a w2k3 server (the D.C) in the same local network. therefore i did not configure this apache server (Enterprise Linux 4) to run DNS service.
 
  


Reply

Tags
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 and virtual host voip_tech_2004 Red Hat 1 04-12-2006 12:36 PM
Apache - Name virtual host tisource Linux - Networking 5 03-03-2006 03:52 AM
Apache 2 Virtual host eckertc1 Linux - Software 6 03-22-2005 10:58 PM
Apache 2.0 Virtual Host? w0lfeyes Linux - Networking 1 05-03-2004 04:09 PM
apache and virtual host diverge Linux - Networking 2 01-11-2004 03:45 AM


All times are GMT -5. The time now is 11:00 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