Navigation

    • Register
    • Login
    • Search
    • Recent
    • Users
    • Groups

    is ngx_pagespeed works?

    CWP - Panel
    2
    6
    96
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      Zikky last edited by

      Hi all,
      I follow thru all steps from this manual: https://www.mysterydata.com/how-to-install-ngx_pagespeed-with-nginx-cwp-vestacp-and-on-linux-os/
      My system:
      CWP
      Nginx + Varnish + Apache PHP-FPM
      nginx version: nginx/1.18.0
      nginx -t:
      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
      nginx: configuration file /etc/nginx/nginx.conf test is successful

      I see, that in “var/ngx_pagespeed_cache” folder some files appeared, but after curl -I -p https://mysite.com/ I can’t find the X-Page-Speed header 😞 and also any changes on site

      Should nginx -V show something like –with-pagespeed_module or smth like that? I mean should I configure nginx with this ngx_pagespeed.so module?
      Thanks!

      sandeep 1 Reply Last reply Reply Quote 0
      • sandeep
        sandeep @Zikky last edited by sandeep

        @zikky
        hi can you send the /etc/nginx/nginx.conf file content here ?

        1 Reply Last reply Reply Quote 0
        • Z
          Zikky last edited by

          load_module "modules/ngx_pagespeed.so";
          user nobody;
          worker_processes auto;
          #worker_rlimit_nofile    65535;
          error_log               /var/log/nginx/error.log crit;
          pid                     /var/run/nginx.pid;
          
          events {
          	worker_connections  1024;
          	use                 epoll;
          	multi_accept        on;
          
          }
          http {
          	sendfile on;
          	tcp_nopush on;
          	tcp_nodelay on;
          	client_header_timeout 3m;
          	client_body_timeout 3m;
          	client_max_body_size 256m;
          	client_header_buffer_size 4k;
          	client_body_buffer_size 256k;
          	large_client_header_buffers 4 32k;
          	send_timeout 3m;
          	keepalive_timeout 60 60;
          	reset_timedout_connection       on;
          	server_names_hash_max_size 1024;
          	server_names_hash_bucket_size 1024;
          	ignore_invalid_headers on;
          	connection_pool_size 256;
          	request_pool_size 4k;
          	output_buffers 4 32k;
          	postpone_output 1460;
          
          	include mime.types;
          	default_type application/octet-stream;
          
          	# Compression gzip
          	gzip on;
          	gzip_vary on;
          	gzip_disable "MSIE [1-6]\.";
          	gzip_proxied any;
          	gzip_min_length 512;
          	gzip_comp_level 6;
          	gzip_buffers 8 64k;
          	gzip_types text/plain text/xml text/css text/js application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg image/svg+xml application/xml+rss text/javascript application/atom+xml application/javascript application/json application/x-font-ttf font/opentype;
          
          	# Proxy settings
          	proxy_redirect      off;
          	proxy_set_header    Host            $host;
          	proxy_set_header    X-Real-IP       $remote_addr;
          	proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
          	proxy_pass_header   Set-Cookie;
          	proxy_connect_timeout   300;
          	proxy_send_timeout  300;
          	proxy_read_timeout  300;
          	proxy_buffers       32 4k;
          	proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=512m;
          	proxy_cache_key "$host$request_uri $cookie_user";
          	proxy_temp_path  /var/cache/nginx/temp;
          	proxy_ignore_headers Expires Cache-Control;
          	proxy_cache_use_stale error timeout invalid_header http_502;
          	proxy_cache_valid any 1d;
          
          	open_file_cache_valid 120s;
          	open_file_cache_min_uses 2;
          	open_file_cache_errors off;
          	open_file_cache max=5000 inactive=30s;
          	open_log_file_cache max=1024 inactive=30s min_uses=2;
          
          	# SSL Settings
          	ssl_session_cache   shared:SSL:10m;
          	ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
          	ssl_prefer_server_ciphers on;
          	ssl_ciphers        "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA!RC4:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS";
          
          	# Logs
          	log_format  main    '$remote_addr - $remote_user [$time_local] $request '
          		                '"$status" $body_bytes_sent "$http_referer" '
          		                '"$http_user_agent" "$http_x_forwarded_for"';
          	log_format  bytes   '$body_bytes_sent';
          	#access_log          /var/log/nginx/access.log main;
          	access_log off;
          
          	# Cache bypass
          	map $http_cookie $no_cache {
          		default 0;
          		~SESS 1;
          		~wordpress_logged_in 1;
          	}
          
          	# Include additional configuration
          	include /etc/nginx/cloudflare.inc;
          	include /etc/nginx/conf.d/*.conf;
          }
          
          sandeep 1 Reply Last reply Reply Quote 0
          • sandeep
            sandeep @Zikky last edited by sandeep

            @zikky and did you added the pagespeed config in nginx domain vhosts ?

                # Pagespeed
                pagespeed on;
                pagespeed FileCachePath /var/ngx_pagespeed_cache;
                location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
                location ~ "^/ngx_pagespeed_static/" { }
                location ~ "^/ngx_pagespeed_beacon" { }
            

            example :

            server {
                listen 123.123.123.123:80;  
                server_name mysterydata.com;
                access_log /usr/local/mysterydata.com.bytes bytes;
                access_log /usr/local/mysterydata.com.log combined;
                error_log /usr/local/mysterydata.com.error.log error;
                
                # Pagespeed
                pagespeed on;
                pagespeed FileCachePath /var/ngx_pagespeed_cache;
                location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
                location ~ "^/ngx_pagespeed_static/" { }
                location ~ "^/ngx_pagespeed_beacon" { }
            
                location / {
                    location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff|ttf|svg|eot|sh)$ {
                        root /usr/local/apache/htdocs/;                     
                        expires max;
                        try_files $uri @backend;
                    }
            }
            
            1 Reply Last reply Reply Quote 0
            • Z
              Zikky last edited by

              Sure, and same for .ssl.conf
              and restart nginx and apache

              I see, that in /var/ngx_pagespeed_cache/ present some folders and files like:
              var/ngx_pagespeed_cache/v3/mysite/http,3A
              var/ngx_pagespeed_cache/v3/mysite/https,3A
              ...
              but headers without X-Page-Speed 😞

              1 Reply Last reply Reply Quote 0
              • sandeep
                sandeep last edited by

                you can pm me the server details

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post

                Recent Topics

                • nginx/1.20.0 ngx_pagespeed module

                • Almalinux support

                • Error Dovecot IMAP/POP3 Server

                • Problem with How to Enable TLS 1.3 in Apache on CWP

                • Successful delivery message

                • Install latest version of Sqlite3 from source Ubuntu/Debian

                • Install latest version of Sqlite3 from source centos/rhel/el7/el8

                • C

                  Mysql load error

                1
                Online

                86
                Users

                117
                Topics

                768
                Posts

                URLs HOME | Blog | Support Portal