0

I hosted my application into Tomcat server and configured server.xml so that i can access my web application by directly accessing the website name eg:www.example.com but it works only when it is followed by my port number for eg: www.example.com:8080, I am using godaddy for VPS.

This is the configuration i have used

  <Host name="example.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
  <Alias>www.example.com</Alias>
  <Context path="" docBase="Prototype" debug="0" privileged="true" />
  <Valve className="org.apache.catalina.valves.AccessLogValve"
         directory="logs"   prefix="localhost_access_log." suffix=".txt"
         pattern="%h %l %u %t &quot;%r&quot; %s %b" resolveHosts="false"/></host> 
varun
  • 25
  • 2
  • 11

2 Answers2

0

but it works only when it is followed by my port number for eg: www.example.com:8080

By 'works' , do you mean Tomcat starts with any port you mention in config but site can be accessed via 8080 only?

if not sure, refer to <tomcat_dir>/logs/catalina.out file to view startup logs,

it so may happen that your VPS has any other application already running on port 80 , httpd typically or NGINX in some cases, you need to stop the app and start tomcat with port 80 in config.

how to check app running on specific port

netstat -apn|grep <port_number>

or

ss -apn|grep <port_number>

in case no app are running on port 80 or any other port you've mentioned in config and tomcat boots successfully, still you are not able to access your app via outside then most likely its network access issue,

for that you need to allow INGRESS access to your desired port in local IP Tables or Godaddy VPS config panel whichever the case may be.

the issue you have mentioned looks more like a linux admin issue. please share more details i will guide you to exact solution

All the best.

Deepkamal
  • 330
  • 1
  • 10
0

You could provide som more info about your VPS. Here I will assume you have a full VPS with root access and you can control the all network access. Apache Tomcat runs by default on port 8080. Effectively you have two options

  1. Run the Tomcat on the port 80 as root ( I don't recommend this approach)
  2. As @Kayaman mentiomed, install an http proxy (apache httpd, nginx,..) which would listen on port 80 and forward all requests to 8080 (search for reverse proxy)

Have fun

gusto2
  • 11,210
  • 2
  • 17
  • 36