I am in a jam. And, I am pulling out what hair I have left. I have a server with CentOS4 on it. It has Tomcat running on port 80. This seems to be hijacking all the sites. By this I mean, I want to run a bunch of non-tomcat sites as well but for the life of me, I cannot get apache to recognize the standard site configurations. All it says when I go to these sites is " The requested URL / was not found on this server. " I then figured, well, perhaps another instance of apache running on a different IP would do the trick. I cannot seem to get that working either. I need to do this because my main server with quite a number of sites on it is down because of a drive failure. I need to copy the sites from a backup to this new server ASAP so I can get the sites back up and running. If ANYONE knows how to either, get apache to serve regular html pages along side of tomcat OR, configure a second instance of apache on a different IP .. well, I would be most grateful. I am really in a bind here.

Dave

Dani AI

Generated

Practical, targeted troubleshooting and small config examples for — common causes for one name returning Tomcat while others timeout are (1) DNS/hosts pointing names to different IPs, (2) a process (Tomcat) bound to the wrong IP:port, or (3) Apache vhost binding misconfiguration (NameVirtualHost / Listen / first-VirtualHost becoming the default). The checklist and examples below are meant to isolate which of those is happening and show minimal config fixes.

Run these checks first to see who owns :80 and where names resolve:

# which process is listening on port 80
netstat -tulpn | grep ':80'
# or
lsof -i :80

# check which IP each hostname resolves to (replace with real names)
dig +short example.com
dig +short www.example.com
# quick HTTP test to a specific IP using the Host header
curl -v --header "Host: www.example.com" http://192.0.2.10/

If DNS/hosts are correct and Tomcat is still serving :80 for some names, restrict or move Tomcat’s connector (or change Apache binding). Example Apache/IP-based vhost and NameVirtualHost (Apache 2.2 era):

Listen 192.0.2.10:80
Listen 192.0.2.11:80
NameVirtualHost 192.0.2.10:80

<VirtualHost 192.0.2.10:80>
  ServerName example.com
  ServerAlias www.example.com
  DocumentRoot /var/www/example
</VirtualHost>

If Tomcat must stay on the server, either move it off port 80 (typical) or bind it to one IP only. Example Tomcat Connector change in server.xml:

<Connector port="8080" protocol="HTTP/1.1" address="192.0.2.12" ... />

Other quick notes: Apache uses the first matching <VirtualHost IP:port> as the default; ensure NameVirtualHost matches the same IP:port as your <VirtualHost> lines; check /etc/hosts for unintended overrides; watch /var/log/httpd/* and Tomcat logs while testing; temporarily stop iptables/SELinux if requests are timing out (and verify with ping/telnet). These targeted checks usually reveal whether the issue is DNS, binding, firewall, or vhost ordering.

An update: I installed a separate instance of Apache listening on a new IP on port 80. Starts and seems to run fine. I added three or four virtualhosts and get no errors on restart. However, only one of the virtual hosts actually comes up when I browse to it and then, only if I do not use www.domain.com ... just domain.com. If I do use www.domain.com .. the default Tomcat page comes up ... which is on another IP altogether. All of the other virtualhosts just timeout.

I sure could use some input and help here if anyone is up for it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.