Search code examples
sslnginxmeteormeteor-up

ssl and https in nginx using meteor


I have this nginx configuration

server {
  listen 80;
  server_name app.com www.app.com;
  rewrite ^ https://$server_name$request_uri? permanent;
}

server {
  listen 443;
  server_name app.com www.app.com;

  ssl on;
  ssl_certificate /etc/nginx/ssl/app.crt;
  ssl_certificate_key /etc/nginx/ssl/server.key;

  location = /favicon.ico {
    root /opt/myapp/app/programs/web.browser/app;
    access_log off;
    expires 1w;
  }

  location ~* "^/[a-z0-9]{40}\.(css|js)$" {
    root /opt/myapp/app/programs/web.browser;
    access_log off;
    expires max;
  }

  location ~ "^/packages" {
    root /opt/myapp/app/programs/web.browser;
    access_log off;
  }

  location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
  }
}

and deployed to ec2 using mup with normal settings

It is deployed and i can access the site app.com

But the https://app.com is not working

as In the config file all the requests are rewriting to https What is happening here

  • I can access the site when I enter app.com that means it is forwarding app.com ad https://app.com
  • I cannot access https://app.com that means nginx is not working

Which of the above two scenarios are true?

I'm out of options. I checked with ssl checkers they are showing that ssl certificate is not installed.

then why my app is working when enter app.com?


Solution

  • Now Meteor Up has the built in SSL Support. No more hard work.

    Just add the SSL certificates and the key and do mup setup.

    We use stud to terminate SSL