nginx中使用meteor的ssl和https
我有这个nginx配置nginx中使用meteor的ssl和https,ssl,nginx,meteor,meteor-up,Ssl,Nginx,Meteor,Meteor Up,我有这个nginx配置 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_cert
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;
}
}
并使用具有正常设置的mup部署到ec2
它已部署,我可以访问网站app.com
但是https://app.com
不工作
正如在配置文件中一样,所有请求都被重写为https
这里发生了什么
- 当我进入app.com时,我可以访问该网站,这意味着它是 转发app.com广告
- 我无法访问,这意味着nginx不工作
那么,为什么我的应用程序在进入app.com时工作?我对NGINX不了解,但看看我的工作生产配置,我看到了一些您没有包含在您的配置中的参数 为了代理websocket连接,您可能特别需要在顶部显示以下内容:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
我的443服务器除了您已有的以外,还包括以下内容:
server {
ssl_stapling on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000;";
location / {
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 http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
最后,我将尝试注释出您的位置指令以进行错误检查。问题不应与SSL证书有关,它仍应允许您访问(带有警告)自签名或配置错误的证书。希望这有帮助。现在Meteor Up已经内置了。不要再辛苦了 只需添加SSL证书和密钥,然后执行
mup设置
我们使用终止SSL
也许您应该尝试群集:。我没有亲自尝试过,但阿鲁诺达在类似问题上做了很多很好的工作。