CPU
The best way to overclock Raspberry Pi it is with the raspi-config tool
raspi-config
I go for the Modest option:
Nginx
Modify nginx.con (/etc/nginx/nginx.conf)
We only have one CPU thread…
worker_processes 1;
In the http { section add the following:
# Optimize memory
open_file_cache max=1000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128;
keepalive_timeout 65;
# Enable website compression - it takes a lot of CPU
# If you are running low on CPU disable the Zip part.
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
Also it is usefull to add:
#Hide Nginx version number server_tokens off;
MySQL
Download and run this script: MySQL Tuner Perl script
perl mysqltuner.pl
then go to /etc/mysql/ and edit my.cnf accordingly.