How to run tomcat7 web app through https over port 8443?

600 Views Asked by At

I have a vaadin 7 app running on tomcat 7 on an EC2 server. The app runs through port 8080, so I redirect my domain from 80 to 8080 using:

/sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Now, I need to use an SSL certificate that should run on ports 8443 or 443, but checking my port using sudo netstat -nlp, I get this:

    Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      2332/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      2371/sendmail       
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2987/mysqld         
tcp        0      0 :::8080                     :::*                        LISTEN      3204/java           
tcp        0      0 :::80                       :::*                        LISTEN      3151/httpd          
tcp        0      0 :::22                       :::*                        LISTEN      2332/sshd           
tcp        0      0 ::ffff:127.0.0.1:8005       :::*                        LISTEN      3204/java           
tcp        0      0 :::8009                     :::*                        LISTEN      3204/java           
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               2063/dhclient       
udp        0      0 172.30.0.27:123             0.0.0.0:*                               2356/ntpd           
udp        0      0 127.0.0.1:123               0.0.0.0:*                               2356/ntpd           
udp        0      0 0.0.0.0:123                 0.0.0.0:*                               2356/ntpd           
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path
unix  2      [ ACC ]     STREAM     LISTENING     1742   2987/mysqld         /var/lib/mysql/mysql.sock
unix  2      [ ACC ]     STREAM     LISTENING     10316  2151/dbus-daemon    /var/run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     9565   1/init              @/com/ubuntu/upstart
unix  2      [ ACC ]     SEQPACKET  LISTENING     9820   1578/udevd          @/org/kernel/udev/udevd

So, as I understand, those ports aren't even there...How can I "activate" them and then use them for my https connection?

1

There are 1 best solutions below

2
On BEST ANSWER

You are supposed to configure your certificate in your tomcat as shown here . Then you should open those ports in the EC2 console as shown here.

enter image description here