incubator-pagespeed-ngx
incubator-pagespeed-ngx copied to clipboard
First gzip compression configuration is always disabled
Hello,
I don't know if I've missmatch any configuration because I'm not able to find anything about this (or maybe I don't know what to search), but when I enable the ngx_pagespeed module on Nginx, the first gzip compression is always disabled and shows a warn message: pagespeed: rollback gzip, explicit configuration ...
I've seen that happens with first configuration, because I've a server with two pages and only the first gets the warning and don't have Gzip compression. When I add the gzip configuracion to main http section then the warning is on nginx.conf file and both webpages have gzip compression enabled.
Greetings!!
Hi, this should not happen, can you post your nginx.config?
If gzip is done by pagespeed, I think is nomal the 1st shot don´t get gziped because pagespeed need more than 1 shot to work, same with all the other filters, 1st time url is not rewrited. I gzip is set in nginx conf then pagespeed disables their own gzip feature because it is explicit set in nginx conf.
Hello,
The problem is that even after some hits the gzip still disabled, and is disabled on the whole web, not only the processed files.
My nginx.conf is:
user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
load_module "modules/ngx_http_geoip_module.so";
load_module "modules/ngx_pagespeed.so";
events {
use epoll;
multi_accept on;
worker_connections 1024;
}
worker_rlimit_nofile 2048;
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Módulo pagespeed
pagespeed On;
pagespeed FileCachePath "/var/cache/ngx_pagespeed/";
pagespeed EnableFilters combine_css,combine_javascript,convert_jpeg_to_progressive,recompress_images;
# Activamos gzip para luchar contra la manía del pagespeed de desactivarlo
gzip on;
sendfile on;
keepalive_timeout 60;
# DDOS
client_body_buffer_size 128k;
large_client_header_buffers 4 256k;
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=50r/s;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*.conf;
include /etc/nginx/upstreams-enabled/*.conf;
include /etc/nginx/maps-enabled/*.conf;
}
and the host conf is:
server {
server_name _;
listen 127.0.0.1:80;
root /opt/www;
index index.php index.html;
autoindex off;
# Logs
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location ~ robots.txt {
return 200 "User-agent: *\nDisallow: /";
add_header Content-Type text/plain;
}
# Show server host name as header
add_header X-Backend-Server $hostname;
# Behind proxy
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
# Compression
# Enable Gzip compressed.
gzip on;
gzip_http_version 1.1;
gzip_disable "msie6";
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_comp_level 5;
# Compress all output labeled with one of the following MIME-types.
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
server_tokens off;
# DOS
limit_conn conn_limit_per_ip 20;
limit_req zone=req_limit_per_ip burst=50 nodelay;
limit_conn_status 499;
## Start: Size Limits & Buffer Overflows ##
client_body_buffer_size 12K;
client_header_buffer_size 12K;
# 413 (Request Entity Too Large)
client_max_body_size 25M;
# 414 (Request-URI Too Large)
# 400 (Bad Request)
large_client_header_buffers 2 12K;
## END: Size Limits & Buffer Overflows ##
## Start: Timeouts ##
# 408 (Request Time-out)
client_body_timeout 10s;
# 408 (Request Time-out)
client_header_timeout 10s;
keepalive_timeout 5s 5;
send_timeout 10s;
## End: Timeouts ##
## Start: File Expiration ##
expires $expires;
## End: File Expiration ##
location / {
try_files $uri $uri/ /index.php?$args; # make index.php handle requests for /
}
location ~* \.(eot|ttf|woff|woff2)$ {
try_files $uri $uri/ @proxy; # look for static files in root directory and ask backend if not successful
add_header Access-Control-Allow-Origin "*";
sendfile on;
sendfile_max_chunk 1m;
access_log off;
}
location ~*\.(jpeg|jpg|gif|png|css|js|ico|swf|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|zip)$ {
try_files $uri $uri/ @proxy; # look for static files in root directory and ask backend if not successful
#add_header Access-Control-Allow-Origin "*";
sendfile on;
sendfile_max_chunk 1m;
access_log off;
}
location @proxy {
fastcgi_pass hhvm_backend; # proxy everything from this location to backend
}
location ~\.php$ { try_files $uri =404; # if reference to php executable is invalid return 404
fastcgi_read_timeout 600;
fastcgi_send_timeout 600;
fastcgi_buffers 8 8k;
fastcgi_buffer_size 8k;
fastcgi_intercept_errors on;
fastcgi_keep_conn on; # use persistent connects to backend
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass hhvm_backend;
}
}
With this configuration the nginx.conf gzip is ignored and then the host gzip works. If i comment the nginx.conf gzip entrie then the host gzip entrie is ignored and the whole page is without gzip.
Greetings!!
Are you using a proxy? If yes, you need to enable gzip for proxy gzip_proxied any; to enable all proxied responses gziped
here you can read it
Hello,
I'm unsing the same nginx as proxy (local), and I've already set the gzip_proxied to any. Without the pagespeed module gzip works perfect with same configuration, but just when I enable the module it shows a warning message about gzip and gets disabled.
Greetings!!
HI @Danixu When you try to the "real" server at 127.0.0.1:80 bypassing the proxy, the issue still here? What is the server config block? In my case, I don´t use proxy, and had the gzip enaled at http block and all the servers block are gzipied. I always get a pagespeed mesage that gzip is disabled because is explicit enable in nginx conf, like this ......pagespeed: rollback gzip, explicit configuration in..... at start time, but all content become compressed
Hi there,
any solution available?
I also facing same issue on my LEMP stack
root@ucsg1:~# tail -f /var/log/nginx/error.log
2019/09/19 22:15:44 [info] 6265#6265: [ngx_pagespeed 1.13.35.2-0] No threading detected. Own threads: 1 Rewrite, 1 Expensive Rewrite.
2019/09/19 22:15:44 [info] 6265#6265: pagespeed: rollback gzip, explicit configuration in /etc/nginx/comp_gzip:2
root@ucsg1:~# nginx -V
nginx version: nginx/1.16.1 (LEMPer)
built by gcc 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
built with OpenSSL 1.1.1c 28 May 2019
But you get content no gzipped? Any luck to get a url to test?
@Lofesa
yes, i got it gzipped
$ curl -H "Accept-Encoding: gzip" -I https://*****.com/ HTTP/2 200 date: Mon, 23 Sep 2019 06:32:23 GMT content-type: text/html; charset=UTF-8 vary: Accept-Encoding server: LEMPer x-fastcgi-cache: HIT x-page-speed: LEMPer/PageSpeed content-encoding: gzip
Whenever I turn off the Gzip, I still get the gziped results on Pagespeed enabled vhost.
So, this is not an issue, right?
2019/09/19 22:15:44 [info] 6265#6265: pagespeed: rollback gzip, explicit configuration in /etc/nginx/comp_gzip:2
This messages is informational, pagespeed disables gzip cause it is enabled in the server.
@Lofesa thanks for the clarification :)
Hi @joglomedia If you enable compression in pagespeed (is done by gzip) , optimized resources are served w/ gzip compression, but if you enable gzip in the server too, then pagespeed disables compression to avoid optimized resources be double gziped so you get the message saying that pagespeed diabless gzip.