Node.js 使用SSL配置Nginx后Meteor应用程序不工作
我已经部署了一个Meteor应用程序,其中Passenger与Nginx集成(如下)。应用程序运行正常,除非我使用以下配置Nginx for SSL 应用SSL后,访问应用程序会显示带有https的nginx欢迎页面 我试过:Node.js 使用SSL配置Nginx后Meteor应用程序不工作,node.js,meteor,nginx,passenger,lets-encrypt,Node.js,Meteor,Nginx,Passenger,Lets Encrypt,我已经部署了一个Meteor应用程序,其中Passenger与Nginx集成(如下)。应用程序运行正常,除非我使用以下配置Nginx for SSL 应用SSL后,访问应用程序会显示带有https的nginx欢迎页面 我试过: 删除root/var/www/html,替换了根/捆绑包/程序/Web服务器 有人能告诉我如何将我的域指向已部署的meteor应用程序吗 我的/etc/nginx/sites enable/default文件如下所示: server { listen 80 ;
删除
root/var/www/html代码>,替换了根/捆绑包/程序/Web服务器代码>
有人能告诉我如何将我的域指向已部署的meteor应用程序吗
我的/etc/nginx/sites enable/default
文件如下所示:
server {
listen 80 ;
listen [::]:80;
# SSL configuration
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
#return 301 https://$server_name$request_uri;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location ~ /.well-known {
allow all;
}
}
而/etc/nginx/example.conf
如下所示:
server {
listen 80;
server_name example.com;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/example/bundle/public;
# Turn on Passenger
passenger_enabled on;
# Tell Passenger that your app is a Meteor app
passenger_app_type node;
passenger_startup_file main.js;
# Tell your app where MongoDB is
passenger_env_var MONGO_URL mongodb://<user>:<password@<host>:<port>/dbName;
passenger_env_var ROOT_URL http://example.com;
}
问题在于,一个教程告诉您编辑default
,另一个教程告诉您创建example.conf
事实上,它们都引用了同一个文件,而您所说的与此无关
目前,您已将配置拆分为两个文件,其中两个server\u name example.com代码>这让人困惑nginx
决定使用哪个文件名,然后删除另一个文件名。结合乘客,让我们将配置加密到一个文件中
例如:
server {
listen 80 ;
listen [::]:80;
# SSL configuration
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
location ~ /.well-known {
root /path/to/ssl/bits;
allow all;
}
root /var/www/example/bundle/public;
...
}
example.conf
是如何来源的?您似乎已经在欢迎页面中添加了SSL支持。“如何获取example.conf
的信息?”您可以再解释一下吗?我没有得到它。它是如何包含在您的nginx.conf
文件中的?我猜现在不是。使用:nginx-T
以准确了解nginx使用的配置。我已更新了nginx的准确配置(nginx-T
)。请您现在检查一下好吗?这里是~/。众所周知的阻止什么是“ssl位的路径”@distalx提问者使用了两个根。一个根在服务器
块中定义,另一个在位置
块中定义。位置块中的根目录
需要指定。众所周知的
目录的位置。@richard smith感谢您为我清除此项。
server {
listen 80 ;
listen [::]:80;
# SSL configuration
listen 443 ssl;
listen [::]:443 ssl;
server_name example.com;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
location ~ /.well-known {
root /path/to/ssl/bits;
allow all;
}
root /var/www/example/bundle/public;
...
}