title: Nginx replace PEM files in configuration
body: <p>I'm configuring my Nginx with some provided certificates.</p>
  
  <p>At first, I tried with self signed certificates, and it works.
  I just used:</p>
  
  <pre><code>$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
  
  $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
  </code></pre>
  
  <p>And editing my self certificates file:</p>
  
  <pre><code>$ sudo nano /etc/nginx/snippets/self-signed.conf
  
  ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
  ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
  </code></pre>
  
  <p>And including the pem file:</p>
  
  <pre><code>$ /etc/nginx/snippets/ssl-params.conf
  ssl_dhparam /etc/ssl/certs/dhparam.pem;
  </code></pre>
  
  <p>Generating a bak file</p>
  
  <pre><code>$ sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.bak
  </code></pre>
  
  <p>And editing the file: <code>/etc/nginx/sites-available/default</code></p>
  
  <p>With</p>
  
  <pre><code>server {
      listen 80 default_server;
      listen [::]:80 default_server;
      server_name server_domain_or_IP;
      return 302 https://$server_name$request_uri;
  }
  
  server {
  
      # SSL configuration
  
      listen 443 ssl http2 default_server;
      listen [::]:443 ssl http2 default_server;
      include snippets/self-signed.conf;
      include snippets/ssl-params.conf;
      ....
  }
  </code></pre>
  
  <p>To test if all is ok, I execute:</p>
  
  <pre><code>sudo nginx -t
  </code></pre>
  
  <p>Ok, that is working, and display a message:</p>
  
  <blockquote>
    <p>This connection is not secure</p>
  </blockquote>
  
  <p>And that is OK, because is a self-signed certificate.</p>
  
  <p>But, at the moment to replace with the valid pem files, my provider sent me 2 files:</p>
  
  <p><code>yourdomain.app-key.pem</code> and <code>yourdomain.app-cert.pem</code></p>
  
  <p>I puth them in the right place and update the file with:</p>
  
  <p>$ sudo nano /etc/nginx/snippets/self-signed.conf</p>
  
  <pre><code>ssl_certificate /etc/ssl/certs/yourdomain.app-cert.pem;
  ssl_certificate_key /etc/ssl/private/yourdomain.app-key.pem;
  </code></pre>
  
  <p>To test if all is ok, I execute:</p>
  
  <pre><code>sudo nginx -t
  
  sudo nginx -t
  nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  nginx: configuration file /etc/nginx/nginx.conf test is successful
  </code></pre>
  
  <p>But, when I try to visit the site, still appears my own self-signed certificate.</p>
  
  <p>What step am I losing in the process?</p>