- Joined
- May 20, 2016
- Messages
- 149
- Points
- 28
After installation is complete LEMP on CentOS, you will need to make some customizations to ensure that the system works faster, speeding up website. Below are some of their operations done every time you install the server.
1. Enable gzip compression
Open the file to install nginx
Adjust Gzip settings
Reload nginx
2. Make Browsers Cache Files Static On nginx
Open the default virtual host file or your custom file
Change the settings as shown below.
Reload Nginx
Good luck!
1. Enable gzip compression
Open the file to install nginx
Code:
sudo nano /etc/nginx/nginx.conf
Code:
...
http {
...
# enable gzip compression
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_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# end gzip configuration
}
...
Code:
sudo /etc/init.d/nginx reload
Open the default virtual host file or your custom file
Code:
sudo nano /etc/nginx/conf.d/default.conf
Code:
[...]
server {
[...]
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
}
[...]
}
[...]
Code:
sudo /etc/init.d/nginx reload