Optimasi nginx

optimasi buffers

client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;

optimasi timeouts

client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;

Gzip Compression (/etc/nginx/nginx.conf)

Cukup hilangkan tanda # di file di atas.

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

Static File Caching

location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
    root /home/kholidfu/path/to/your/statics/;
    expires 365d;
}

Matikan access_log

Hal ini biasa saya lakukan untuk web yang sudah agak settle, demi mengoptimalkan kinerja server, access_log biasanya saya nonaktifkan.

access_log off;

restart nginx service

sudo service nginx restart

Reference: digitalocean

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s