Created
January 19, 2012 21:49
-
-
Save carlhoerberg/1643033 to your computer and use it in GitHub Desktop.
Nginx config template
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-data; | |
pid /var/run/nginx.pid; | |
worker_processes 1; | |
events { | |
worker_connections 1024; # increase if you have lots of clients | |
accept_mutex off; # "on" if nginx worker_processes > 1 | |
use epoll; # enable for Linux 2.6+ | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
sendfile on; | |
tcp_nopush on; # off may be better for *some* Comet/long-poll stuff | |
tcp_nodelay off; # on may be better for some Comet/long-poll stuff | |
gzip on; | |
gzip_proxied any; | |
gzip_vary on; | |
gzip_min_length 512; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_types text/plain text/xml text/css | |
text/comma-separated-values | |
application/javascript | |
text/javascript application/x-javascript | |
application/atom+xml application/json; | |
upstream app_server { | |
server 127.0.0.1:8080; | |
#server unix:/tmp/thin.sock; | |
} | |
server { | |
listen 80 deferred; | |
rewrite ^(.*) https://www.cloudpostgres.com$1 permanent; | |
server_name cloudpostgres.com www.cloudpostgres.com; | |
} | |
server { | |
if ($http_host !~* www.cloudpostgres.com) { | |
rewrite ^(.*) https://www.cloudpostgres.com$1 permanent; | |
} | |
listen 443 deferred ssl default_server; | |
ssl_certificate certs/www.cloudpostgres.com.pem; | |
ssl_certificate_key certs/www.cloudpostgres.com.key; | |
ssl_ciphers HIGH:!aNULL:!MD5L:!kEDH; | |
ssl_session_cache shared:SSL:1m; | |
client_max_body_size 5M; | |
keepalive_timeout 5; | |
root /home/torquebox/cloudpostgres/current/public; | |
try_files $uri @app; | |
location @app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment