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? |
Why are you port mapping? You can run the virual hosts off of 80 as well.
|
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? |
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
|
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 ] |
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. |
Quote:
Can you post an example output of your virtual host setup/config here? |
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> |
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 Code:
NameVirtualHost *:80 Code:
<VirtualHost 192.168.1.10> Code:
<VirtualHost *> |
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 |
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? |
Rakesh, Frank is spot on. Start a new thread.
Frank, post the VirualHost settings from your httpd.conf |
Quote:
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:
|
Quote:
|
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. |