Created
March 29, 2010 14:42
-
-
Save julien51/347898 to your computer and use it in GitHub Desktop.
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
| user www-data; | |
| worker_processes 4; | |
| error_log /var/log/nginx/error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| accept_mutex on; | |
| worker_connections 1024; | |
| # multi_accept on; | |
| use epoll; | |
| } | |
| http { | |
| include /etc/nginx/mime.types; | |
| access_log /var/log/nginx/access.log combined; | |
| # fallback in case we can't determine a type | |
| default_type application/octet-stream; | |
| sendfile on; | |
| #tcp_nopush on; | |
| #keepalive_timeout 0; | |
| keepalive_timeout 65; | |
| tcp_nodelay on; | |
| gzip on; | |
| gzip_disable "MSIE [1-6]\.(?!.*SV1)"; | |
| # this can be any application server, not just Unicorn/Rainbows! | |
| upstream app_server { | |
| # 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). | |
| # for UNIX domain socket setups: | |
| server unix:/tmp/unicorn.sock fail_timeout=0; | |
| } | |
| include /etc/nginx/conf.d/*.conf; | |
| include /etc/nginx/sites-enabled/*; | |
| } | |
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
| server { | |
| listen 80 default; | |
| client_max_body_size 4G; | |
| server_name _; | |
| ## | |
| # Redirect any www request to the bare domain | |
| if ($host = 'www.superfeedr.com' ) { | |
| rewrite ^/(.*)$ http://superfeedr.com/$1 permanent; | |
| } | |
| # ~2 seconds is often enough for most folks to parse HTML/CSS and | |
| # retrieve needed images/icons/frames, connections are cheap in | |
| # nginx so increasing this is generally safe... | |
| keepalive_timeout 5; | |
| access_log /var/log/nginx/superfeedr.access.log; | |
| # path for static files | |
| root /var/www/apps/superfeedr.com/current/public; | |
| location / { | |
| # an HTTP header important enough to have its own Wikipedia entry: | |
| # http://en.wikipedia.org/wiki/X-Forwarded-For | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| # enable this if and only if you use HTTPS, this helps Rack | |
| # set the proper protocol for doing redirects: | |
| # proxy_set_header X-Forwarded-Proto https; | |
| # pass the Host: header from the client right along so redirects | |
| # can be set properly within the Rack application | |
| proxy_set_header Host $http_host; | |
| # we don't want nginx trying to do something clever with | |
| # redirects, we set the Host: header above already. | |
| proxy_redirect off; | |
| # set "proxy_buffering off" *only* for Rainbows! when doing | |
| # Comet/long-poll stuff. It's also safe to set if you're | |
| # using only serving fast clients with Unicorn + nginx. | |
| # Otherwise you _want_ nginx to buffer responses to slow | |
| # clients, really. | |
| # proxy_buffering off; | |
| # if you are serving static files from nginx, try to serve them less | |
| if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)\?[0-9]+$") { | |
| expires max; | |
| break; | |
| } | |
| # Maintenance page. | |
| # We hijack all traffic from this point if a maintenance page is showed | |
| if (-f $document_root/system/maintenance.html){ | |
| rewrite ^(.*)$ /maintenance.html break; | |
| } | |
| # Try to serve static files from nginx, no point in making an | |
| # *application* server like Unicorn/Rainbows! serve static files. | |
| if (!-f $request_filename) { | |
| proxy_pass http://app_server; | |
| break; | |
| } | |
| } | |
| location /http-bind/ { | |
| proxy_buffering off; | |
| tcp_nodelay on; | |
| keepalive_timeout 55; | |
| proxy_pass http://xmpp-internal.superfeedr.com:5280/http-bind/; | |
| } | |
| location /apple-touch-icon-precomposed.png { | |
| rewrite ^ http://en.gravatar.com/avatar/a2f7d4dd6df7dd59e4adab811c00a3a1.jpg?size=57 permanent; | |
| } | |
| # Rails error pages | |
| error_page 500 502 503 504 /500.html; | |
| location = /50x.html { | |
| root /var/www/apps/superfeedr.com/current/public; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment