Report this

What is the reason for this report?

How to point Nginx to serve Capistrano deployment location (/home/rails/apps/appname/current) on Rails one click application?

Posted on November 4, 2018

Hello,

I have set up a Rails one click application and have configured Capistrano to deploy to /home/rails/apps/appname/current. All of the files are present and there are no errors during deployment. Before I setup Capistrano I explored the Nginx files in /etc/nginx/sites-enabled and /etc/nginx/sites-available. Following this tutorial (https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma), I have created a symlink to an nginx.conf file stored at /home/rails/apps/appname/current/config.nginx.conf to exist at /etc/nginx/sites-enabled/sites-enabled/appname. However, when I visit my site via its IP or domain, I get a simple “connected refused” error, telling me that the nginx server isn’t pointing to the right place.

My question is this: given that the Rails one click app originally launches using /etc/nginx/sites-enabled/rails (the configuration there is what makes the example Rails app work), is this somehow interfering with the symlink to the nginx.conf file I’ve created with Capistrano? I am quite confident that everything is correct on the Capistrano side (it is an exact copy of the nginx.conf from the tutorial linked above with my app and server details in the relevant places) and that the issue is with the pre-popualated files at various places within /etc/nginx/*.

There is another issue which I think might play a role: the Rails one click app boots via /etc/systemd/system/rails.service, and within that file there’s a call to puma. Is this a case of nginx not recognising or reading the .conf file defined within the app I’ve deployed, an issue with rails.service pre-defined by the one-click app, or something else? In short, I am wondering whether the defaults setup in the one-click are taking precedence over the Capistrano files I’ve deployed.

Many thanks for any help.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.