Created
February 24, 2013 13:29
-
-
Save amichaelgrant/5023846 to your computer and use it in GitHub Desktop.
Nginx+Tcp+proxy
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
http { | |
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; | |
proxy_temp_path /var/tmp; | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
gzip_comp_level 6; | |
gzip_vary on; | |
gzip_min_length 1000; | |
gzip_proxied any; | |
gzip_types text/plain text/html text/css application/json application/x-javascript application/xml application/xml+rss text/javascript; | |
gzip_buffers 16 8k; | |
upstream emoks_upstream { | |
server 127.0.0.1:3000; | |
server 127.0.0.1:3001; | |
keepalive 64; | |
} | |
server { | |
listen 80; | |
listen 443 ssl; | |
ssl_certificate /usr/local/nginx/ssl/bundle.crt; | |
ssl_certificate_key usr/local/nginx/ssl/bundle.key; | |
ssl_protocols SSLv3 TLSv1; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
server_name emoks.com; | |
return 301 $scheme://www.emoks.com$request_uri; | |
} | |
server { | |
listen 80; | |
listen 443 ssl; | |
ssl_certificate /usr/local/nginx/ssl/bundle.crt; | |
ssl_certificate_key usr/local/nginx/ssl/bundle.key; | |
ssl_protocols SSLv3 TLSv1; | |
ssl_ciphers HIGH:!aNULL:!MD5; | |
server_name www.emoks.com; | |
error_page 502 /errors/502.html; | |
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) { | |
root /var/local/src/_emoks_/public; | |
access_log off; | |
expires max; | |
} | |
location /errors { | |
internal; | |
alias /var/local/src/_emoks_/public/errors; | |
} | |
location / { | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
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-NginX-Proxy true; | |
proxy_set_header Connection ""; | |
proxy_http_version 1.1; | |
proxy_cache one; | |
proxy_cache_key sfs$request_uri$scheme; | |
proxy_pass http://emoks_upstream; | |
} | |
} | |
} | |
tcp { | |
upstream cluster { | |
# simple round-robin | |
server 127.0.0.1:3001; | |
server 127.0.0.1:3000; | |
check interval=3000 rise=2 fall=5 timeout=1000; | |
#check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello; | |
#check interval=3000 rise=2 fall=5 timeout=1000 type=http; | |
#check_http_send "GET / HTTP/1.0\r\n\r\n"; | |
#check_http_expect_alive http_2xx http_3xx; | |
} | |
server { | |
listen 90; | |
proxy_pass cluster; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment