0

This is my current server.xml file. I would like to access my application using http://www.myapp.subdomain.com without port number 8080. But in the below changes nothing is loaded when i try using this URL : http://www.myapp.subdomain.com.

<?xml version='1.0' encoding='utf-8'?>   
<Server port="8005" shutdown="SHUTDOWN">   
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />   
  <Listener className="org.apache.catalina.core.JasperListener" />   
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />   
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />   
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />   
  <GlobalNamingResources>   
    <Resource name="UserDatabase" auth="Container"  
              type="org.apache.catalina.UserDatabase"  
              description="User database that can be updated and saved"  
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"  
              pathname="conf/tomcat-users.xml" />   
  </GlobalNamingResources>   
  <Service name="Catalina">   
    <Connector port="80" protocol="HTTP/1.1"    
               connectionTimeout="20000"    
               redirectPort="8443" />   
    <Engine name="Catalina" defaultHost="localhost">   
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"  
             resourceName="UserDatabase"/>   
    <Host name="www.mydomain.subdomain.com" appBase="webapps/myapps"  
          unpackWARs="true" autoDeploy="true"  
          xmlValidation="false" xmlNamespaceAware="false">   
         <Context path="" docBase="."/>   
            <Alias>.mydomain.subdomain.com</Alias>   
        </Host>   

    </Engine>   
  </Service>   
</Server>  

Could you please help on this?.

Kind Regards S.Saravanan

2 Answers 2

2

You need to find the following part of server.xml file and change it to look like:

<Connector port="80" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443" />

Then, you should restart your tomcat.

1
  • This only did not work for me
    – diyoda_
    Sep 18, 2015 at 2:48
0

If you don't want to run tomcat as root, you can translate the port with iptables like:

/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
/sbin/iptables-save
/sbin/chkconfig iptables on

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .