title: Enable port 443 on Linux Nginx
body: <p>I'm trying to enable port 443 on Linux Nginx as I'm trying to install an SSL certificate. I've ran <code>sudo lsof -i -P -n | grep LISTEN</code> and got the following:</p>
  <pre><code>rpcbind   1751      rpc    8u  IPv4   15914      0t0  TCP *:111 (LISTEN)
  rpcbind   1751      rpc   11u  IPv6   15917      0t0  TCP *:111 (LISTEN)
  master    2172     root   13u  IPv4   17752      0t0  TCP 127.0.0.1:25 (LISTEN)
  nginx     2264     root    6u  IPv4   19741      0t0  TCP *:80 (LISTEN)
  nginx     2264     root    7u  IPv6   19742      0t0  TCP *:80 (LISTEN)
  nginx     2265    nginx    6u  IPv4   19741      0t0  TCP *:80 (LISTEN)
  nginx     2265    nginx    7u  IPv6   19742      0t0  TCP *:80 (LISTEN)
  nginx     2266    nginx    6u  IPv4   19741      0t0  TCP *:80 (LISTEN)
  nginx     2266    nginx    7u  IPv6   19742      0t0  TCP *:80 (LISTEN)
  sshd      7640     root    3u  IPv4 1317041      0t0  TCP *:22 (LISTEN)
  sshd      7640     root    4u  IPv6 1317050      0t0  TCP *:22 (LISTEN)
  </code></pre>
  <p><code>sudo netstat -tulpn | grep :443</code> doesn't give any result either.</p>
  <p>I ran <code>sudo iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT</code> but this didn't work. I did not get any results after this command.</p>
  <p>My server is running on AWS EC2 and my security group has HTTPS enabled, but I still have the same issue.</p>
  <p>My nginx.conf looks like this. I've added settings for a TLS enabled server listening on port 443:</p>
  <pre><code>    server {
          listen       80;
          listen       [::]:80;
          server_name  _;
          location / {
                  root /home/ec2-user;
                  try_files $uri $uri/ /index.html;
  #               add_header 'Access-Control-Allow-Origin' '*';
  
          }
  
          # Load configuration files for the default server block.
          include /etc/nginx/default.d/*.conf;
  
          error_page 404 /404.html;
          location = /404.html {
          }
  
          error_page 500 502 503 504 /50x.html;
          location = /50x.html {
          }
      }
  
  # Settings for a TLS enabled server.
  
     server {
         listen       443 ssl http2;
         listen       [::]:443 ssl http2;
         server_name  _;
         root         /home/ec2-user;
  
         ssl_certificate &quot;/etc/pki/nginx/server.crt&quot;;
         ssl_certificate_key &quot;/etc/pki/nginx/private/server.key&quot;;
         ssl_session_cache shared:SSL:1m;
         ssl_session_timeout  10m;
         ssl_ciphers PROFILE=SYSTEM;
         ssl_prefer_server_ciphers on;
  
         # Load configuration files for the default server block.
         include /etc/nginx/default.d/*.conf;
  
         error_page 404 /404.html;
            location = /40x.html {
         }
  
         error_page 500 502 503 504 /50x.html;
             location = /50x.html {
         }
     }
  
  </code></pre>