Skip to content

Instantly share code, notes, and snippets.

@iMagesh
Created November 6, 2014 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iMagesh/6d952deee93f64cbf10b to your computer and use it in GitHub Desktop.
Save iMagesh/6d952deee93f64cbf10b to your computer and use it in GitHub Desktop.
Nginx config new one
upstream railsapp {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response (in case the Unicorn master nukes a single worker for timing out).
server 10.0.0.5:8182;
#server unix:/var/www/meralabour/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name app.atsquare.in;
access_log /var/log/nginx/railsapp-access.log;
error_log /var/log/nginx/railsapp-error.log;
root /var/www/railsapp/public;
location / {
proxy_pass http://railsapp;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_redirect off;
#proxy_set_header X-Forwarded-For $remote_addr;
#proxy_set_header Host $host;
#proxy_set_header X-Url-Scheme $scheme;
auth_basic "Restricted"; #For Basic Auth
auth_basic_user_file /var/www/railsapp/.htpasswd; #For Basic Auth
}
#keepalive_timeout 10;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment