Skip to content

Nginx config

Oscar edited this page Sep 29, 2020 · 1 revision

Nginx config template if you want to deploy on a cloud server

upstream your_app_name {
  server unix:/PATH/TO/YOUR/APP/ROOT/shared/tmp/sockets/puma.sock;
}

server {
  listen 80 default_server;
  server_name YOUR.DOMAIN.COM;

  root /PATH/TO/YOUR/APP/ROOT/current/public;
  access_log /PATH/TO/YOUR/APP/ROOT/current/log/nginx.access.log;
  error_log /PATH/TO/YOUR/APP/ROOT/current/log/nginx.error.log info;

  location / {
    try_files $uri @puma;
  }
  

  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://your_app_name;
  }
}

Clone this wiki locally