title: How to run Nuxt project in HTTPS?
body: <p>I managed turn nginx into https. When  I changed its configuration to support running of nuxt project. Then simply nginx is not opening the site.</p>
  
  <p>I suspect because my nuxt project is not working in https. So how can I run nuxt in https.</p>
  
  <p>What I did:
  I reinstalled nginx I used letsencrypt bot to install certificates. Then I checked if nginx became https. 
  Then I ran the nuxt in npm run start. Then changed the configuration of the nginx to support running nuxt. 
  Then the page was not visible anymore.</p>
  
  <p>Update 1:
  I have uninstalled nginx.
  I started the nuxt in production mode.
  I changed the nginx according to get the proxy.</p>
  
  <pre><code>map $sent_http_content_type $expires {
      "text/html"                 epoch;
      "text/html; charset=utf-8"  epoch;
      default                     off;
  }
  
  server {
      listen          80;             # the port nginx is listening on
      server_name     example.me wwww.example.me;    # setup your domain here
  
  
      gzip            on;
      gzip_types      text/plain application/xml text/css application/javascript;
      gzip_min_length 1000;
  
      location / {
          expires $expires;
  
          proxy_redirect                      off;
          proxy_set_header Host               $host;
          proxy_set_header X-Real-IP          $remote_addr;
          proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto  $scheme;
          proxy_read_timeout          1m;
          proxy_connect_timeout       1m;
          proxy_pass                          http://127.0.0.1:3000; # set the adress of the Node.js instance here
      }
  
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/example.me-0001/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/example.me-0001/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  
  }
  </code></pre>
  
  <p>Now for some reason it works.. I have installed before the certificate maybe those certificates did not get uninstalled. It is actually difficult to understand how it started to work.</p>
  
  <p>However it also allows now http also. I want to direct all http to https but when I put </p>
  
  <pre><code>map $sent_http_content_type $expires {
      "text/html"                 epoch;
      "text/html; charset=utf-8"  epoch;
      default                     off;
  }
  
  server {
      listen          80;             # the port nginx is listening on
      server_name     example.me wwww.example.me;    # setup your domain here
      return 301 https://$host$request_uri;
  
      gzip            on;
      gzip_types      text/plain application/xml text/css application/javascript;
      gzip_min_length 1000;
  
      location / {
          expires $expires;
  
          proxy_redirect                      off;
          proxy_set_header Host               $host;
          proxy_set_header X-Real-IP          $remote_addr;
          proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
          proxy_set_header X-Forwarded-Proto  $scheme;
          proxy_read_timeout          1m;
          proxy_connect_timeout       1m;
          proxy_pass                          http://127.0.0.1:3000; # set the adress of the Node.js instance here
      }
  
      listen 443 ssl; # managed by Certbot
      ssl_certificate /etc/letsencrypt/live/example.me-0001/fullchain.pem; # managed by Certbot
      ssl_certificate_key /etc/letsencrypt/live/example.me-0001/privkey.pem; # managed by Certbot
      include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
      ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
  
  }
  </code></pre>
  
  <p>return 301 https://$host$request_uri; is causing everything crash</p>
  
  <p>Now new issue is calling from https web service. But for this topic it is closed.</p>