Huge thanks to @bounga for his post that didn't assume you've got a working /etc/nginx.conf
. Everyone else's posts just assume that you've got the same /etc/nginx.conf
as they do, and when you don't, you're screwed.
I like the sites-available/sites-enabled
paradigm so I did this:
mkdir /etc/nginx/sites-available /etc/nginx/sites-enabled
ln -s /etc/nginx/sites-enabled /etc/nginx/vhosts.d
I highly recommend using capistrano-puma. Super basic steps condensed from the capistrano-puma readme:
- Add this to your Gemfile in the development group: gem 'capistrano3-puma', github: "seuros/capistrano-puma"
- Add this to your Capfile: require 'capistrano/puma' require 'capistrano/puma/nginx'
- Run
cap puma:nginx_config
to generate the two ERB templates inconfig/deploy/templates
- Add this to your
config/deploy.rb
: set :nginx_server_name, "YOUR_WEBSERVER_FQDN OTHER_ALIASES localhost" - Uncomment this line in your
config/deploy.rb
: append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system" - Replace the
/etc/nginx.conf
on your server with the one in this gist. - Run
cap production puma:nginx_config
I think that's all of it. I'll validate it another time and make this more complete. Maybe.