Saturday, 15 April 2017

Meteor application not working after configuring Nginx for SSL

I've deployed a Meteor application with Passenger integrated with Nginx(following this documentation). The application was running fine unless I configured Nginx for SSL with Lets Encrypt following this documentation.

After applying SSL the visiting the application shows the welcome page of nginx with https.

I've tried:
removed root /var/www/html;, replaced root <meteor directory>/bundle/programs/webserver;

Can anybody tell how to point my domain to the deployed meteor application?

My /etc/nginx/sites-enable/default file looks like:

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

And the /etc/nginx/example.conf looks like bellow:

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



via mostafiz rahman

No comments:

Post a Comment