NGINX on ubuntu optimization

check how many worker_processes you got:

 grep --count processor /proc/cpuinfo

make a backup:

sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx-org.conf
sudo nano /etc/nginx/nginx.conf  

change worker_processes to the number you got earlier.
and for the gzip all you have to do is uncomment this line by removing #:

    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

uncomment

gzip_vary_on 

as well.

let the other commands be by default.

exit and save
ctrl x + y

//cache//
now lets add this to the config:
sudo nano /etc/nginx/sites-available/default
at the bottom inside the serverblock thats in use!!!

server{

location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff|ttf|svg|otf)$ {
	expires 30d;
	add_header Pragma public;
	add_header Cache-Control "public";
}

}

sudo nginx -t
After everything is successful restart your server:
sudo service nginx restart

Add your comment