Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

apache not serving on vitural host

Status
Not open for further replies.

tlgates

Programmer
May 29, 2003
16
US
I am using apache2 on redhat linux. I am trying to setup virtual hosts to serve. My pages display correctly using localhost and test.yoursummit.com but when I try to use my test.benefitserver.com virtual host, the images, css, etc files that apache serves don't display. What am I doing wrong? My files are placed in the DocumentRoot directories and are being found when I use localhost or test.yoursummit.com in the url but not when I use test.benefitserver.com. I don't understand.

Here's my /etc/hosts file:
127.0.0.1 localhost.localdomain localhost
69.155.252.166 test.yoursummit.com

Here's my httpd.conf file:
Listen 69.155.252.166:80
Listen 127.0.0.1:80
ServerName test.yoursummit.com
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
ServerAlias test.yoursummit.com
DocumentRoot /var/</VirtualHost>

<VirtualHost *:80>
ServerName test.benefitserver.com
DocumentRoot /var/</VirtualHost>

I really need to get this working today. Your help is greatly appreciated!
 
On what machine are you running your web browser? Is it on the same machine as the server?

Does test.benefitserver.com resolve to an IP address? I notice no mention of it in your hosts file.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Yes. I am running the web browser on the same machine as the server. Even when I try to hit the web pages from a different machine, I get the same results.

The test.benefitserver.com should go to the same IP as test.yoursummit.com. I just want a virtual host. Do I have to put it in the hosts file?
 
Here's what happens when you point your browser to [ignore][/ignore]:
[ul]
[li]the browser must resolve test.benefitserver.com to an IP address. This must be available in the local hosts file or in DNS.[/li]
[li]The browser then connects on port 80 to the IP address it found in step 1[/li]
[li]The browser then sends at least the following HTTP request headers:
[tt]GET / HTTP/1.1
Host: test.benefitserver.com[/tt][/li]
[li]Apache then has to decide which virtual server's data the browser has requested:[/li]
[ul]
[li]If there is only one virtual server on that IP address and port, Apache sends the data from that one site.[/li]
[li]If Apache has multiple virtual servers on that IP address and port, it compares the ServerName and ServerAlias entries for all virtual hosts to the value given by the browser in the "Host:" file.[/li]
[ul]
[li]if Apache finds a match, it sends data from the matching virtual host[/li]
[li]if Apache does not find a match, I think it will try to pull data from the first virtual host on that IP and port in the http.conf file[/li]
[/ul]
[/ul]
[/ul]


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks. I modified my /etc/hosts file on my server.

Now have:
127.0.0.1 localhost.localdomain localhost
69.155.252.166 test.yoursummit.com test.benefitserver.com

I have restarted apache and I have reboot my server. I still don't get the images/css files to display.
 
I don't think that will work.

Using the line:

69.155.252.166 test.yoursummit.com test.benefitserver.com

is telling your system that test.benefitserver.com is an alias for test.yoursummit.com. This may give you strange behavior from your browser.

Try:

69.155.252.166 test.yoursummit.com
69.155.252.166 test.benefitserver.com


instead.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I did a ping and here is the results:

PING test.benefitserver.com (69.155.252.166) 56(84) bytes of data.
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=0 ttl=64 time=0.024 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=1 ttl=64 time=0.018 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=2 ttl=64 time=0.019 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=3 ttl=64 time=0.016 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=4 ttl=64 time=0.024 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=5 ttl=64 time=0.017 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=6 ttl=64 time=0.018 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=7 ttl=64 time=0.020 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=8 ttl=64 time=0.018 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=9 ttl=64 time=0.020 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=10 ttl=64 time=0.019 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=11 ttl=64 time=0.019 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=12 ttl=64 time=0.017 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=13 ttl=64 time=0.018 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=14 ttl=64 time=0.018 ms
64 bytes from test.yoursummit.com (69.155.252.166): icmp_seq=15 ttl=64 time=0.018 ms

--- test.benefitserver.com ping statistics ---
16 packets transmitted, 16 received, 0% packet loss, time 15010ms
rtt min/avg/max/mdev = 0.016/0.018/0.024/0.006 ms, pipe 2
 
Okay, the FQDN is resolving to an IP address....

Waitaminit.

You're pointing to

[ignore][/ignore] and
[ignore][/ignore]

With your directory layout, wouldn't

[ignore][/ignore]

be correct, as the test.benefitserver.com document root atcually be the benefitserver directory?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Right you are. I changed the DocumentRoot to be /var/ and it worked. Sorry to be such a bonehead! I appreciate your help!
 
OK. I had this working on Friday and now it doesn't work anymore. I had modified my httpd.conf file to include several more VirtualHosts and I have working with my server.xml file on Tomcat to setup another context. Now I'm back to it not displaying the images/css files again. I removed the changes that I did to the httpd.conf file and that didn't help.

Here is code snippet of my httpd.conf:
Code:
DirectoryIndex index.html index.html.var index.htm index.jsp
AccessFileName .htaccess

NameVirtualHost *:80
#
<VirtualHost *:80>
    ServerName localhost
    ServerAlias test.yoursummit.com
    ServerAdmin webmaster@yoursummit.com
    DocumentRoot /var/[URL unfurl="true"]www/html[/URL]
    ErrorLog /var/[URL unfurl="true"]www/yoursummit/logs/errorlog[/URL]
    CustomLog /var/[URL unfurl="true"]www/yoursummit/logs/access_log[/URL] common
</VirtualHost>
                                                                                                
<VirtualHost *:80>
    ServerName test.benefitserver.com
    ServerAdmin tgates@yoursummit.com
    DocumentRoot /var/[URL unfurl="true"]www/html[/URL]
    ErrorLog /var/[URL unfurl="true"]www/html/logs/testbs_errorlog[/URL]
    CustomLog /var/[URL unfurl="true"]www/html/logs/testbs_access_log[/URL] common
</VirtualHost>

It's also not forwarding or recongnizing the index.jsp file in the directories to pull it up automatically. I have to type in the index.jsp in the URL to have it bring up the page.

What's going on? Please help!!!
 
Additionally, I find that if I try to access the pages with it works.

I need it to work under https:// and it won't serve up the images/css files using SSL.

Please Help!!! I'm really frustrated at this since it was working on Friday and not it's not but I don't think that I changed anything relevant to make it stop working.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top