Created
August 14, 2011 09:09
-
-
Save jie/1144726 to your computer and use it in GitHub Desktop.
nginx.conf http and https
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 1; | |
error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} | |
http { | |
charset utf-8; | |
upstream frontends { | |
server 127.0.0.1:9999; | |
} | |
include mime.types; | |
default_type application/octet-stream; | |
access_log /var/log/nginx/access.log; | |
keepalive_timeout 65; | |
proxy_read_timeout 200; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
gzip on; | |
gzip_min_length 1000; | |
gzip_proxied any; | |
gzip_types text/plain text/css | |
application/x-javascript application/xml | |
application/atom+xml text/javascript; | |
# Only retry if there was a communication error, not a timeout | |
# on the Tornado server (to avoid propagating "queries of death" | |
# to all frontends) | |
proxy_next_upstream error; | |
server { | |
listen 80; | |
# Allow file uploads | |
client_max_body_size 50M; | |
location ^~ /static/ { | |
root /var/www/gitpub/application/; | |
if ($query_string) { | |
expires max; | |
} | |
} | |
location = /favicon.ico { | |
rewrite (.*) /static/favicon.ico; | |
} | |
location = /robots.txt { | |
rewrite (.*) /static/robots.txt; | |
} | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_pass http://frontends; | |
} | |
} | |
server { | |
server_name localhost; | |
listen 443; | |
ssl on; | |
ssl_certificate /etc/nginx/gitpub_cert/server.crt; | |
ssl_certificate_key /etc/nginx/gitpub_cert/server.key; | |
# Allow file uploads | |
client_max_body_size 50M; | |
location ^~ /static/ { | |
root /var/www/gitpub/application/; | |
if ($query_string) { | |
expires max; | |
} | |
} | |
location = /favicon.ico { | |
rewrite (.*) /static/favicon.ico; | |
} | |
location = /robots.txt { | |
rewrite (.*) /static/robots.txt; | |
} | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_pass http://frontends; | |
} | |
} | |
# include /etc/nginx/sites-enabled/*; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment