Created
April 13, 2011 06:43
-
-
Save sdiehl/917078 to your computer and use it in GitHub Desktop.
nginx 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
| worker_processes 1; | |
| user http users; | |
| pid /tmp/nginx.pid; | |
| error_log /tmp/nginx.error.log; | |
| events { | |
| worker_connections 1024; | |
| accept_mutex off; | |
| } | |
| # This is the important stuff !! | |
| tcp { | |
| upstream cluster { | |
| # This is the local port running on your app | |
| # server, which is inaccessible from outside | |
| server 127.0.0.1:8000; | |
| } | |
| server { | |
| # This is the port you will expose to the public, | |
| # must be different then above. | |
| listen 7000; | |
| proxy_read_timeout 200000; | |
| proxy_send_timeout 200000; | |
| proxy_pass cluster; | |
| } | |
| } | |
| http { | |
| include mime.types; | |
| default_type application/octet-stream; | |
| access_log /tmp/nginx.access.log combined; | |
| sendfile on; | |
| tcp_nopush on; | |
| tcp_nodelay off; | |
| upstream app_server { | |
| # For a TCP configuration: | |
| # Replace 8000 with app servers port | |
| server 127.0.0.1:8000 fail_timeout=0; | |
| # For a Unix Socket | |
| # server unix:/tmp/yourappserver.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80 default; | |
| client_max_body_size 4G; | |
| server_name _; | |
| keepalive_timeout 5; | |
| # path for static files | |
| root /path/to/static/files; | |
| location / { | |
| 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://app_server; | |
| break; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment