Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用SSL配置Nginx后Meteor应用程序不工作_Node.js_Meteor_Nginx_Passenger_Lets Encrypt - Fatal编程技术网

Node.js 使用SSL配置Nginx后Meteor应用程序不工作

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 ;

我已经部署了一个Meteor应用程序,其中Passenger与Nginx集成(如下)。应用程序运行正常,除非我使用以下配置Nginx for SSL

应用SSL后,访问应用程序会显示带有https的nginx欢迎页面

我试过:
删除
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;
    ...
}