0

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.

Ryan
  • 157
  • 1
  • 13
  • 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

2 Answers2

1

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
0

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
    </Proxy>
</VirtualHost>
ALex_hha
  • 7,025
  • 1
  • 23
  • 39