Created
December 7, 2012 19:39
-
-
Save raedatoui/4235893 to your computer and use it in GitHub Desktop.
Nginx sample config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream unicorn_production { | |
server unix:/usr/local/nature-valley/current/tmp/sockets/unicorn.sock; | |
} | |
server { | |
listen 80; | |
server_name "Name of the server"; | |
access_log /var/log/nginx/nv.log; | |
error_log /var/log/nginx/nv.error.log; | |
root "public directory of Rails App; | |
index index.html; | |
if ($http_user_agent = "-" ) { | |
return 403; | |
} | |
if ($http_user_agent = "" ) { | |
return 403; | |
} | |
location / { | |
root /usr/local/nature-valley/current/public; | |
#auth_basic "Restricted"; | |
#auth_basic_user_file /etc/nginx/htpasswd; | |
client_max_body_size 100M; | |
client_body_buffer_size 1M; | |
#proxy_pass_header X-Accel-Redirect; | |
proxy_pass_header Set-Cookie; | |
proxy_pass_header P3P; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
if (!-f $request_filename) { | |
proxy_pass http://unicorn_production; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment