Skip to content

Instantly share code, notes, and snippets.

@webhacking
Last active January 4, 2016 06:05
Show Gist options
  • Save webhacking/958ae2e8c09674932428 to your computer and use it in GitHub Desktop.
Save webhacking/958ae2e8c09674932428 to your computer and use it in GitHub Desktop.

#How to fast nginx? user www-data; worker_processes auto; pid /run/nginx.pid;

events {
        worker_connections 4000;
        # optmized to serve many clients with each thread, essential for linux
        use epoll;

        # accept as many connections as possible, may flood worker connections if set too low
        multi_accept on;

}

http {

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 30;
        types_hash_max_size 2048;
        server_tokens off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;


        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip on;
        gzip_min_length 10240;
        gzip_proxied expired no-cache no-store private auth;
        gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
        gzip_disable "MSIE [1-6]\.";

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment