Nginx gzip error "gzip" directive is duplicate in / etc/nginx/conf.d/

nginx configuration

gzip on;
gzip_min_length 1k;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
server {
  listen 80;
  server_name **.com
  return 301 https://www.**.com$request_uri;
}
server {
  listen 443;
  server_name   **.com
  ssl on;
  ssl_certificate ** 
  ssl_certificate_key **
  ssl_session_timeout 5m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;   
  ssl_ciphers **
  ssl_prefer_server_ciphers on;
  if ($ssl_protocol = "") {
    rewrite ^(.*) https://$host$1 permanent;
  }
  location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-Nginx-Proxy true;
    proxy_redirect off;
    root /www/html;
    index index.html index.htm;
   }
 }         
Mar.01,2021

Let's see which other files are configured in / etc/nginx/conf.d/ . gzip on;
can be removed

also: gzip_types Why to configure the picture type.

Menu