Skip to content

Instantly share code, notes, and snippets.

@vhsalazar
Created August 29, 2014 17:32
Show Gist options
  • Save vhsalazar/20fbe1f64c6d615594c7 to your computer and use it in GitHub Desktop.
Save vhsalazar/20fbe1f64c6d615594c7 to your computer and use it in GitHub Desktop.
Nginx config - Rails
upstream backend {
server 127.0.0.1:9000;
}
log_format default_log '$host $remote_addr [$time_local] "$request" $status $request_length "$http_referer" "$http_user_agent" $request_time';
server {
listen 80;
server_name _; # all accept
access_log /var/log/nginx/access.log default_log;
location ~ ^/assets/ {
root /var/www/dashboard/current/public;
gzip_static on; # to serve pre-gzipped version
expires 1y;
add_header Cache-Control public;
add_header ETag "";
break;
}
location / {
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_pass http://backend;
proxy_redirect off;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment