-2

I have a remote server, and its default port is 8080, but you know the browser default use 80 port to access it, so can not access my tomcat.

How to configure it to access the tomcat's 8080 port?

It is under the windows.

If I use www.example.com:8080 in the browser I can access the server, but if I use www.example.com I can not access it.


EDIT

I use Tomcat + IIS (Server Consolidation), IIS occupy the 80 port.

karlson
  • 4,759
  • 3
  • 25
  • 57
qg_java_17137
  • 2,484
  • 4
  • 30
  • 60
  • 'If I use www.example.com:8080 in the browser I can access the server, but if I use www.example.com I can not access it.' I agree. So what's the question? – user207421 May 06 '17 at 10:52
  • @EJP yes, How can I use the `www.example.com` to access the tomcat(its default port is 8080, if I do not change the tomcat's port )? – qg_java_17137 May 06 '17 at 12:29

2 Answers2

1

You cannot access the URL on http://www.example.com because the browser will try to make a TCP connection on port 80 while tomcat is listening to post 8080.

If you want to change the port tomcat is listening to, see this question

Another option is to use a proxy in front of your tomcat server. You can use apache web server or Nginx. They can listen to port 80 and forward your request to the tomcat server on port 8080.

Update

As mentioned in the comments below, as the post80 is already taken, adding reverse proxy cannot help. Because the reverse proxy will not be able to listen to port 80.

It is recommended to see which process is using port 80 and then a proper solution can be implemented.

Update

As IIS is listening on port 80, it is recommended to configure IIS to act as the reverse proxy.

You can follow this link to do so.

Amr ElAdawy
  • 3,663
  • 5
  • 31
  • 48
0

You can change tomcat connector port number. Navigate to /tomcat-root/conf folder. Within you will find the server.xml file.

Open the server.xml and search for connector port and change it.

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