I'm not too familiar with server configuration especially CentOS or Redhat based server configuration.

The problem that I am currently having is that I have Tomcat6 installed. When I go to my website address: www.example.com:8080 I can see the default page with no problem. If I go to just: www.example.com I am getting a could not be found page.

Is there a way in CentOS or by Tomcat settings to have my domain URL always display what is on port 8080?

I do not have regular Apache installed; only Tomcat Apache.

  • Why not to just configured tomcat on port 80 instead of 8080 . In server.xml file chnage the port 8080 to 80. Once done restart tomcat and you will be able to access your website running on tomcat . – Abhishek Anand Amralkar Jul 18 '13 at 13:28

You can also achieve redirection is done by using the following iptables commands issued in sequence. The first one will configure the machine to accept incoming connections to port 80, the second does the same for port 8080 and the third one will do the actual rerouting.

  iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
  iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
  iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
  • iptables will redirect ALL incoming connection on port 80. Maybe it's not what you expect – ALex_hha Jul 18 '13 at 13:45

You could try

<VirtualHost www.example.com:80>
    ServerName www.example.com
    ProxyRequests Off
    ProxyPreserveHost On

    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    <Proxy *>
        Order deny,allow
        Allow from all
  • I made same mistake at first, he doesn't have HTTPD. only Tomcat. – user160910 Jul 18 '13 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.