Skip to content
kez edited this page Sep 6, 2012 · 1 revision

Nginx Deployment

This is the Nginx config file I typically use for a Ramaze deployment. Over past years, it was common to do a "does this file exist" check before sending the request to the @ramaze proxy; this is now deprecated in favour of try_files.

This forwards domain.com to www.domain.com with a permanent redirect.

upstream ramaze {  server 127.0.0.1:7000; }

server { 
  server_name domain.com;
  rewrite ^ $scheme://domain.com$request_uri? permanent;
}

server {
  server_name   www.domain.com;
  access_log    /srv/ramaze_app/log/access.log;
  error_log     /srv/ramaze_app/log/error.log;
  root          /srv/ramaze_app/public;

  index   index.html;

  location / {
    try_files $uri $uri/ @ramaze;
  }

  location @ramaze {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_redirect off;
    proxy_pass http://ramaze;
    break;
  }
}
Clone this wiki locally