1
votes

I have an issue with accessing my website without having to specify the port number in the URL.

I have a droplet on DigitalOcean and have followed their guide on how to install and setup Tomcat. I have deployed my ROOT.war file and I can access my website by going to myipaddress:8080.

From the research I did, I understand that to access my website without having to specify the port I need to change it in server.xml from 8080 to 80.

This stops my application from working, the server's running, but I can no longer access my website.

It just says this site can't be reached.

Most people suggest to edit /etc/default/tomcat9 and set authbind to yes.

I simply don't have this file anywhere, event after installing authbind, I have looked in every directory, any suggestions?

2
please specify your Operating systemMahmoud Eltayeb
Ubuntu 16.04.6 x64cris22tian
Can you access the server locally ? like localhost/[yourApplicationContext] ? if you can then @MahmoudEltayeb comment would be the next step to allow HTTP and your site should work on port 80Osama.070032
There is a workaround I always use by using a reverse proxy (nginx for example) that listen remotely to port 80 and forward the traffic to your tomcat portMahmoud Eltayeb

2 Answers

1
votes

Follow the below steps:

1) Change tomcat port to 80

2) Remove the existing ROOT folder from webapps in tomcat

3) In file tomcat/webapps/manager/META-INF/context.xml you need to comment valve tag to allow manger to be accessed.

    <Context antiResourceLocking="false" privileged="true">
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>

change it to

<Context antiResourceLocking="false" privileged="true" >
  <!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->

</Context>

3) deploy your war file as ROOT.war file

4) start the server

5) Now try to access by domain name

Note : if your application having context path, you may need to try domain_name/context_path

0
votes

Try the following as root

ufw allow HTTP