nginx for rails with puma

upstream puma {
  server unix://home/deployer/apps/myapp/shared/tmp/sockets/myapp-puma.sock;

server {
  listen 80 default_server deferred;

  root /home/deployer/apps/myapp/current/public;
  access_log /home/deployer/apps/myapp/current/log/nginx.access.log;
  error_log /home/deployer/apps/myapp/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;

provisioning a new vps

1. add a new user

adduser deployer

adduser deployer sudo

2. from your local machine, copy ssh public key to the server, so you can login without being asked for the pasword

ssh-copy-id deployer@server

note: generate your ssh public key if you did not yet

ssh-keygen -b 4096

3. prevent root login and password authentication

in /etc/ssh/sshd_config , make sure that