title: How to install SSL Certificate on Centos 7 with Nginx
body: <p>I've needed to set up SSL on my server, and have been putting it off, I've now done it, and found it a lot simpler than expected, so for anyone else, here's the process I followed.</p>
  
  <p>I have a dedicated server, and have downloaded a GeoTrust Certificate and Private Key (supplied by my host).</p>
  
  <p>I have uploaded both of these to /etc/nginx/ssl/ (as root).</p>
  
  <p>I added the following to my Nginx default.conf:</p>
  
  <pre><code>server {
    server_name www.example.com;
    listen 443;
    ssl on;
    ssl_certificate /etc/nginx/ssl/www.example.com_ssl_certificate.cer;
    ssl_certificate_key /etc/nginx/ssl/www.example.com_private_key.key;
  
    location / {
      allow all;
  
      # Proxy Headers
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-Cluster-Client-Ip $remote_addr;
  
      # The Important Websocket Bits!
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
  
      proxy_pass http://examplecom;
    }
  }
  </code></pre>
  
  <p>I have opened up port 443 as follows:</p>
  
  <pre><code>firewall-cmd --permanent --zone=public --add-port=443/tcp
  </code></pre>
  
  <p>And added https service:</p>
  
  <pre><code>firewall-cmd --permanent --zone=public --add-service=https
  </code></pre>
  
  <p>I can now access the app over https at my domain.</p>
  
  <p>The final issue is setting up the Phoenix web sockets over wss, I will edit this post and add that information as soon as I have it done.</p>
  
  <p>HTH someone.</p>
  
  <pre><code>Centos 7
  Nginx 1.10.1
  </code></pre>