使用启用了ssl的proxypass部署节点js app

时间:2016-12-21 16:42:06

标签: meteor nginx

我有一个我正在运行的ameteor ap,它在我的服务器上运行,如

http://my-ip:3000

我安装了nginx,我可以使用这个启用网站的配置访问meteor应用程序

我的文件看起来像这样

server {
listen *:80;
server_name _;

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;
}
}

我正在按照本教程让letsencrypt工作https://gist.github.com/cecilemuller/a26737699a7e70a7093d4dc115915de8

如何在上面的配置中启用ssl

1 个答案:

答案 0 :(得分:0)

要使用ssl运行,请确保您拥有letencrypt证书,这是我的配置

server {
    listen 80;
    return 301 https://$host$request_uri;
}

server {

    listen 443;
    server_name domain.com;

    ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    access_log            /var/log/nginx/meteor.access.log;

    location / {

      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;

      # Fix the “It appears that your reverse proxy set up is broken" error.
      proxy_pass          http://localhost:3000;
      proxy_read_timeout  90;

      proxy_redirect      http://localhost:3000 https://domain.com;
    }
  }

上面运行了启用了ssl的meteor应用程序。