OS : Ubuntu
My domain name requires port 8080 in the URL . I tried changing server.xml file in the Tomcat folder to port 80 . Then I did tomcat restart , but it did not work.
<Connector port=“80” protocol=“HTTP/1.1” connectionTimeout=“20000” redirectPort=“8443” />
Can you please let me know where I need to make the change.
Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Guys, after a while trying to find a solution without interfering in iptables as suggested @arunm8489 , I found a solution. The solution proposed by @manandharbishes is ok but we need one more step by changing /etc/default/tomcat8 From: #AUTHBIND=no to AUTHBIND=yes
In the comments of this file, they say:
For you guys, this is the script I followed:
$ nano /etc/tomcat8/server.xml
change the port from 8080 to 80
$ touch /etc/authbind/byport/80
$ chmod 500 /etc/authbind/byport/80
$ nano /usr/share/tomcat8/bin/setenv.sh
CATALINAOPTS=”-Djava.net.preferIPv4Stack=true”
$ nano /usr/share/tomcat8/bin/startup.sh
exec authbind –deep “$PRGDIR”/”$EXECUTABLE” start “$@”
$ nano /etc/default/tomcat8
AUTHBIND=yes
Thats it!
This question was answered by @mpatidar:
It’s workable solution. Let the port 8080 by default in server.xml
Run : sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
This redirect traffic from port 80 to 8080 (default in tomcat) in Ubuntu 14.04 it is not possible to set the default port to 80 in server.xml.
To make this persistent: sudo apt-get install iptables-persistent
This package allows you to save iptables rules previously entered. Be sure to answered yes (save the current settings)
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.