Last active
October 12, 2015 09:28
-
-
Save dekart/4006649 to your computer and use it in GitHub Desktop.
Performance optimizations
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
timer_resolution 100ms; | |
worker_priority -5; | |
events { | |
use epoll; | |
worker_connections 2048; | |
} | |
server { | |
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers RC4:HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_timeout 20m; | |
access_log off; | |
# GZIP compression | |
gzip on; | |
gzip_min_length 1000; | |
gzip_comp_level 3; | |
gzip_types text/plain text/css text/javascript application/x-javascript application/json; | |
gzip_proxied any; | |
gzip_vary on; | |
# Performance & connectivity optimizations | |
tcp_nodelay on; | |
keepalive_timeout 600s; | |
# Ignored URLs | |
location ~ null { return 404; } | |
location ~ google-analytics\.com/ga\.js { return 404; } | |
location ~ avg_ls_dom\.js { return 404; } | |
location ~* /(assets|images|stylesheets|javascripts|fonts|system) { | |
expires 1y; | |
add_header Cache-Control public; | |
gzip_static on; | |
open_file_cache max=1000 inactive=600s; | |
open_file_cache_valid 600s; | |
open_file_cache_errors on; | |
try_files $uri =404; | |
} | |
location ~* ^.+\.(jpg|jpeg|gif|png|css|bmp|ico|swf)$ { | |
expires 1y; | |
add_header Cache-Control public; | |
gzip_static on; | |
open_file_cache max=1000 inactive=600s; | |
open_file_cache_valid 600s; | |
open_file_cache_errors on; | |
try_files $uri =404; | |
} | |
} |
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
# Compiling Nginx with SPDY support | |
export NGINX_VERSION="1.3.14" | |
cd /usr/src | |
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | |
tar xzvf ./nginx-$NGINX_VERSION.tar.gz && rm -f ./nginx-$NGINX_VERSION.tar.gz | |
wget http://zlib.net/zlib127.zip | |
unzip zlib127.zip && rm -f zlib127.zip | |
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz | |
tar xzvf openssl-1.0.1e.tar.gz && rm -f openssl-1.0.1e.tar.gz | |
cd nginx-$NGINX_VERSION | |
wget http://nginx.org/patches/spdy/patch.spdy.txt && patch -p1 < patch.spdy.txt | |
./configure --prefix=/opt/nginx --with-pcre=/usr/src/pcre-8.30 --with-zlib=/usr/src/zlib-1.2.7 --with-openssl-opt=no-krb5 --with-openssl=/usr/src/openssl-1.0.1e --with-http_ssl_module --without-mail_pop3_module --without-mail_smtp_module --without-mail_imap_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_spdy_module | |
make && make install |
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
# Add to /etc/rc.local before 'exit 0' | |
ip route change default via `ip route| awk '/^def/{print $3}'` dev eth0 metric 100 initcwnd 16 |
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
# Add to the end of /etc/sysctl.conf file | |
net.ipv4.tcp_slow_start_after_idle=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment