LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Can't connect to Virtual Host in Apache (https://www.linuxquestions.org/questions/linux-enterprise-47/cant-connect-to-virtual-host-in-apache-493795/)

frankkky 10-19-2006 05:20 AM

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?

billymayday 10-19-2006 05:22 AM

Why are you port mapping? You can run the virual hosts off of 80 as well.

frankkky 10-19-2006 11:44 AM

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?

billymayday 10-19-2006 03:27 PM

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

Jaqui 10-20-2006 07:39 AM

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 ]

frankkky 10-20-2006 10:40 AM

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.

trickykid 10-20-2006 10:56 AM

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?

frankkky 10-20-2006 12:52 PM

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>

trickykid 10-20-2006 01:42 PM

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.

rakesh_jims 10-20-2006 03:16 PM

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

frankkky 10-21-2006 03:38 AM

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?

billymayday 10-21-2006 04:33 AM

Rakesh, Frank is spot on. Start a new thread.

Frank, post the VirualHost settings from your httpd.conf

trickykid 10-21-2006 09:28 AM

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 ;)

trickykid 10-21-2006 09:29 AM

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?

frankkky 10-21-2006 12:15 PM

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.


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