Cannot change port number for Tomcat Server on Ubuntu 22.04 Azure VM

Viewed 29

I am running an Azure VM with Ubuntu 22.04 and installed a tomcat server. Somehow, the only Port I can run it on is 8080.

When I configure these connector ports in my server.xml file, it only runs on 8080

<Connector port="8080" protocol="HTTP/1.1"
    connectionTimeout="20000"
    redirectPort="8443"/>
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true" scheme="https">
    <SSLHostConfig>
        <Certificate certificateFile="conf/cert.pem"
                     certificateKeyFile="conf/privkey.pem"
                     certificateChainFile="conf/chain.pem" />
    </SSLHostConfig>
</Connector>

Here the output of my ports (on 8081 I run Jenkins)

$ sudo netstat -tnlp
tcp6       0      0 :::8080                 :::*                    LISTEN      1584/java           
tcp6       0      0 :::8081                 :::*                    LISTEN      629/java   

I tried changing it to the standard ports like this:

<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
    redirectPort="443"/>
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"            maxThreads="150" SSLEnabled="true" scheme="https">
    <SSLHostConfig>
        <Certificate certificateFile="conf/cert.pem"
                     certificateKeyFile="conf/privkey.pem"
                     certificateChainFile="conf/chain.pem" />
    </SSLHostConfig>
</Connector>

But then this is the output I get:

$ sudo netstat -tnlp
tcp6       0      0 :::8081                 :::*                    LISTEN      629/java  

I don't know if it matters (I guess not), but I generated the certificate with letsencrypt. I don't think that matters, because it doesn't run on Port 80 either, but just mentioning it.

Maybe it has something to do with the Azure VM? I configured all the inbound ports there. enter image description here

Did I miss some configuration? Or why doesn't it work?

EDIT I managed to run it on Port 80 with Authbind. Port 8443 and 443 still don't work, not even with authbind.

EDIT2

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
8080/tcp                   ALLOW       Anywhere                  
7474/tcp                   ALLOW       Anywhere                  
8081/tcp                   ALLOW       Anywhere                  
80/tcp                     ALLOW       Anywhere                  
443/tcp                    ALLOW       Anywhere                  
7687/tcp                   ALLOW       Anywhere                  
443                        ALLOW       Anywhere                  
8080/tcp (v6)              ALLOW       Anywhere (v6)             
7474/tcp (v6)              ALLOW       Anywhere (v6)             
8081/tcp (v6)              ALLOW       Anywhere (v6)             
80/tcp (v6)                ALLOW       Anywhere (v6)             
443/tcp (v6)               ALLOW       Anywhere (v6)             
7687/tcp (v6)              ALLOW       Anywhere (v6)             
443 (v6)                   ALLOW       Anywhere (v6)
0 Answers
Related