Enable GZIP for Nginx

This commit is contained in:
Quan Tran
2022-04-08 16:18:36 +07:00
committed by Dat H. Pham
parent ec1e3fb075
commit 701502c6b7
2 changed files with 47 additions and 14 deletions
+43 -11
View File
@@ -1,17 +1,49 @@
server {
user nginx;
worker_processes auto;
listen 80;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
events {
worker_connections 1024;
}
error_page 500 502 503 504 /50x.html;
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
location = /50x.html {
root /usr/share/nginx/html;
}
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
gzip_static on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_http_version 1.1;
}