Li Yannan
Li Yannan

Reputation: 41

How to set up a meteor server on https connection?

I have a local meteor server running on port 3000.Then I want add the SSL Certificate to my project.I have generate the SSL files, what should I do the next?

Upvotes: 0

Views: 1068

Answers (1)

Firdaus Ramlan
Firdaus Ramlan

Reputation: 1146

Deploy the app using Meteor Up which have built in SSL support.

Or use common web server like Nginx or Apache, setup SSL and reverse proxy back to meteor app.

Example: Nginx configuration

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

server {
  listen 443 ssl ;
  server_name www.example.com;

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

  location / {
    proxy_pass http://127.0.0.1:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
  }

}

Upvotes: 1

Related Questions