Как включить сжатие на nginx?

Пользователь

от aaron_armstrong , в категории: Другие , 2 года назад

Как включить сжатие на nginx?

Facebook Vk Ok Twitter LinkedIn Telegram Whatsapp

2 ответа

Пользователь

от jorge , 2 года назад

@aaron_armstrong чтобы включить сжатие на nginx обновите Ваш файл конфигурации /etc/nginx/nginx.conf и добавьте следующее:


1
2
3
4
5
6
gzip on; 
gzip_vary on; 
gzip_min_length 1024; 
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]\.";


И перезагрузите сервер выполнив service nginx reload

Пользователь

от dayna , год назад

@aaron_armstrong 

To enable compression in Nginx, you can add the following lines to your Nginx configuration file:

1
2
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;


This will enable gzip compression for specified MIME types. You can adjust the list of MIME types based on your requirements.