Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to host and run tomcat without using an arbitrary port. How do I do it.

share|improve this question

migrated from stackoverflow.com Oct 2 '12 at 22:26

This question came from our site for professional and enthusiast programmers.

    
None of these links helped at all? –  Jon Lin Oct 2 '12 at 17:58
    
What exactly do you mean by "without using an arbitrary port"? What port do you want to run it on? –  Ex Umbris Oct 2 '12 at 22:02

2 Answers 2

You have not specified your Linux version, Tomcat version and whether or not you are using the "system" Tomcat [ the version that installs via the package manager ].

I will answer on the assumption that you are on a recent edition of Ubuntu and using a Tomcat 6 that has been installed via the package manager.

  1. Edit /etc/tomcat6/server.xml and change the port from 8080 to 80 in the line that starts with 'Connector port="8080" protocol="HTTP/1.1" ...'. If you are using HTTPS, you may also need to change the port for that from 8443 to 443 ( same file, the connector specification starts with 'Connector port="8443"...'. If you change this, also change the redirect port in the first connector to 443.
  2. Edit /etc/default/tomcat6 and change “#AUTHBIND=no” to “AUTHBIND=yes”. If you do not do this, the Tomcat will not be allowed by the OS to bind to ports 80 and 443 when it is started as the tomcat6 user. Ports with numbers below 1024 are considered "privileged" and can ordinarily only be bound to by processes running with root user privileges. Authbind allows processes running as non-root users to bind to privileged ports.
  3. Restart tomcat (“sudo /etc/init.d/tomcat6 restart”)

If your system differs significantly from my assumed system, comment and I may be able to adapt this answer.

share|improve this answer

1) Locate server.xml in {Tomcat installation folder}\ conf \

2) Find the line similar to this -

<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           redirectPort="8443" />

Change 8080 to some other port number like 8181

3) Restart tomcat.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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