Created
July 28, 2014 08:23
-
-
Save polikeiji/2b6056610d6fc0bc55a7 to your computer and use it in GitHub Desktop.
gunicornのリバースプロキシ付きのnginx.conf
This file contains 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
user www; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
sendfile on; | |
keepalive_timeout 65; | |
include /etc/nginx/conf.d/*.conf; | |
index index.html; | |
upstream app_server { | |
server 127.0.0.1:8000 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name [DOMAIN]; | |
root /home/www/[APP NAME]/server/html; | |
access_log /var/log/nginx/[APP NAME].access.log main; | |
location / { | |
try_files $uri @proxy_to_app; | |
} | |
location @proxy_to_app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
} | |
error_page 404 /404.html; | |
location = /40x.html { | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment