Nginx with Lets encrypt loading "Welcome to Nginx" instead of my rails app

Hello, I have recently deployed my Ruby on Rails application to a plain Ubuntu 16.04 droplet with Nginx, passenger & Let’s encrypt.

The rails app worked fine without Let’s encrypt but as soon as I installed it, I can’t seem to understand why it’s pointing to the “Welcome to Nginx” page instead of my rails app.

In /etc/nginx/sites-enabled/default I’ve used:

root /var/www/myapp;
root /var/www/myapp/code;
root /var/www/myapp/code/public;

This is where my application is.

Under /etc/nginx/nginx.conf I’ve tried using these:

user www-data;
user rails;
user root;

And I’ve even changed the ownership around a few times for root, rails and www-data:

sudo chown -R www-data:www-data /var/www/myapp
sudo find /var/www/myapp -type d -exec chmod 770 {} \;
sudo find /var/www/myapp -type f -exec chmod 660 {} \;

I don’t know what gives… I keep getting “403 Forbidden nginx/1.14.0” but it worked fine and launched my deployed app without Let’s Encrypt.

I would love some help, thank you!


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Let’s Encrypt scripts change Nginx configuration. It happened with my Nginx installation too. I just manually installed certificates, instead of running scripts.

Hello friend!

I couldn’t say with absolute authority as much of this is going to be relative to your configuration, but it sounds like the configuration for HTTP and HTTPS may not match. You might check every config file starting at nginx.conf, and then any/every directory which is included by instruction in that primary file. Something is overriding what you had before, and the good news is that it has to be somewhere close by in those configurations.

Kind Regards, Jarland