ioweb-gr edited a comment on issue #1897:
URL: 
https://github.com/apache/incubator-pagespeed-mod/issues/1897#issuecomment-968746800


   I struggled a bit on how to remove the location directive which precedes the 
pagespeed one and now I have this
   
   <summary>new nginx.conf
   <details>
   
   ```
   server {
           listen 135.181.x.x:443 ssl http2;
   
           server_name subdomain.example.com;
           server_name www.subdomain.example.com;
           server_name ipv4.subdomain.example.com;
   
           ssl_certificate             /opt/psa/var/certificates/scfzuSka7;
           ssl_certificate_key         /opt/psa/var/certificates/scfzuSka7;
   
           client_max_body_size 128m;
   
           proxy_read_timeout 3600;
   
           # mailconfig
           location ~* ^/autodiscover/autodiscover\.xml$ {
                   try_files $uri @mad;
           }
           location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
                   try_files $uri @mad;
           }
   
           location  ~* ^/email\.mobileconfig$ {
                   try_files $uri @mad;
           }
   
           location @mad {
                   rewrite ^(.*)$ /mailconfig/ break;
   
                   proxy_pass                          http://127.0.0.1:8880;
                   proxy_set_header X-Host             $host;
                   proxy_set_header X-Request-URI      $request_uri;
           }
           # mailconfig
   
           root "/var/www/vhosts/subdomain.example.com/httpdocs";
           access_log 
"/var/www/vhosts/system/subdomain.example.com/logs/proxy_access_ssl_log";
           error_log 
"/var/www/vhosts/system/subdomain.example.com/logs/proxy_error_log";
   
           #extension letsencrypt begin
           location ^~ /.well-known/acme-challenge/ {
                   root /var/www/vhosts/default/htdocs;
   
                   types { }
                   default_type text/plain;
   
                   satisfy any;
                   auth_basic off;
                   allow all;
   
                   location ~ ^/\.well-known/acme-challenge.*/\. {
                           deny all;
                   }
           }
           #extension letsencrypt end
   
           #extension sslit begin
   
           add_header Strict-Transport-Security "max-age=15768000; 
includeSubDomains" always;
   
           #OCSP Stapling
           ssl_stapling on;
           ssl_stapling_verify on;
   
           #extension sslit end
   
           error_page 400 "/error_docs/bad_request.html";
           error_page 401 "/error_docs/unauthorized.html";
           error_page 403 "/error_docs/forbidden.html";
           error_page 404 "/error_docs/not_found.html";
           error_page 500 "/error_docs/internal_server_error.html";
           error_page 405 "/error_docs/method_not_allowed.html";
           error_page 406 "/error_docs/not_acceptable.html";
           error_page 407 "/error_docs/proxy_authentication_required.html";
           error_page 412 "/error_docs/precondition_failed.html";
           error_page 414 "/error_docs/request_uri_too_long.html";
           error_page 415 "/error_docs/unsupported_media_type.html";
           error_page 501 "/error_docs/not_implemented.html";
           error_page 502 "/error_docs/bad_gateway.html";
           error_page 503 "/error_docs/maintenance.html";
   
           location ^~ /error_docs {
                   root "/var/www/vhosts/subdomain.example.com";
           }
   
           location / {
                   proxy_pass https://135.181.x.x:7081;
                   proxy_hide_header upgrade;
                   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_set_header X-Accel-Internal 
/internal-nginx-static-location;
                   access_log off;
   
           }
   
           location /internal-nginx-static-location/ {
                   alias /var/www/vhosts/subdomain.example.com/httpdocs/;
                   internal;
           }
   
           location ~ 
^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                   proxy_pass https://135.181.x.x:7081;
                   proxy_hide_header upgrade;
                   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_set_header X-Accel-Internal 
/internal-nginx-static-location;
                   access_log off;
   
           }
   
           location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
                   fastcgi_read_timeout 3600;
                   alias /var/www/vhosts/subdomain.example.com/web_users/$1/$2;
                   fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                   try_files $uri $fastcgi_script_name =404;
                   fastcgi_param PATH_INFO $fastcgi_path_info;
                   fastcgi_pass 
"unix:/var/www/vhosts/system/subdomain.example.com/php-fpm.sock";
                   include /etc/nginx/fastcgi.conf;
   
           }
   
           location ~ ^/~(.+?)(/.*)?$ {
                   proxy_pass https://135.181.x.x:7081;
                   proxy_hide_header upgrade;
                   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_set_header X-Accel-Internal 
/internal-nginx-static-location;
                   access_log off;
   
           }
   
           location ~ \.php(/.*)?$ {
                   fastcgi_read_timeout 3600;
                   fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                   try_files $uri $fastcgi_script_name =404;
                   fastcgi_param PATH_INFO $fastcgi_path_info;
                   fastcgi_pass 
"unix:/var/www/vhosts/system/subdomain.example.com/php-fpm.sock";
                   include /etc/nginx/fastcgi.conf;
   
           }
   
           add_header X-Powered-By PleskLin;
   
           include 
"/var/www/vhosts/system/subdomain.example.com/conf/vhost_nginx.conf";
   }
   
   server {
           listen [2a01:4f9:xx:xxxx::2]:443 ssl http2;
   
           server_name subdomain.example.com;
           server_name www.subdomain.example.com;
           server_name ipv6.subdomain.example.com;
   
           ssl_certificate             /opt/psa/var/certificates/scfzuSka7;
           ssl_certificate_key         /opt/psa/var/certificates/scfzuSka7;
   
           client_max_body_size 128m;
   
           proxy_read_timeout 3600;
   
           # mailconfig
           location ~* ^/autodiscover/autodiscover\.xml$ {
                   try_files $uri @mad;
           }
           location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
                   try_files $uri @mad;
           }
   
           location  ~* ^/email\.mobileconfig$ {
                   try_files $uri @mad;
           }
   
           location @mad {
                   rewrite ^(.*)$ /mailconfig/ break;
   
                   proxy_pass                          http://127.0.0.1:8880;
                   proxy_set_header X-Host             $host;
                   proxy_set_header X-Request-URI      $request_uri;
           }
           # mailconfig
   
           root "/var/www/vhosts/subdomain.example.com/httpdocs";
           access_log 
"/var/www/vhosts/system/subdomain.example.com/logs/proxy_access_ssl_log";
           error_log 
"/var/www/vhosts/system/subdomain.example.com/logs/proxy_error_log";
   
           #extension letsencrypt begin
           location ^~ /.well-known/acme-challenge/ {
                   root /var/www/vhosts/default/htdocs;
   
                   types { }
                   default_type text/plain;
   
                   satisfy any;
                   auth_basic off;
                   allow all;
   
                   location ~ ^/\.well-known/acme-challenge.*/\. {
                           deny all;
                   }
           }
           #extension letsencrypt end
   
           #extension sslit begin
   
           add_header Strict-Transport-Security "max-age=15768000; 
includeSubDomains" always;
   
           #OCSP Stapling
           ssl_stapling on;
           ssl_stapling_verify on;
   
           #extension sslit end
   
           error_page 400 "/error_docs/bad_request.html";
           error_page 401 "/error_docs/unauthorized.html";
           error_page 403 "/error_docs/forbidden.html";
           error_page 404 "/error_docs/not_found.html";
           error_page 500 "/error_docs/internal_server_error.html";
           error_page 405 "/error_docs/method_not_allowed.html";
           error_page 406 "/error_docs/not_acceptable.html";
           error_page 407 "/error_docs/proxy_authentication_required.html";
           error_page 412 "/error_docs/precondition_failed.html";
           error_page 414 "/error_docs/request_uri_too_long.html";
           error_page 415 "/error_docs/unsupported_media_type.html";
           error_page 501 "/error_docs/not_implemented.html";
           error_page 502 "/error_docs/bad_gateway.html";
           error_page 503 "/error_docs/maintenance.html";
   
           location ^~ /error_docs {
                   root "/var/www/vhosts/subdomain.example.com";
           }
   
           location / {
                   proxy_pass https://[2a01:4f9:xx:xxxx::2]:7081;
                   proxy_hide_header upgrade;
                   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_set_header X-Accel-Internal 
/internal-nginx-static-location;
                   access_log off;
   
           }
   
           location /internal-nginx-static-location/ {
                   alias /var/www/vhosts/subdomain.example.com/httpdocs/;
                   internal;
           }
   
           location ~ 
^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                   proxy_pass https://[2a01:4f9:xx:xxxx::2]:7081;
                   proxy_hide_header upgrade;
                   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_set_header X-Accel-Internal 
/internal-nginx-static-location;
                   access_log off;
   
           }
   
           location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
                   fastcgi_read_timeout 3600;
                   alias /var/www/vhosts/subdomain.example.com/web_users/$1/$2;
                   fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                   try_files $uri $fastcgi_script_name =404;
                   fastcgi_param PATH_INFO $fastcgi_path_info;
                   fastcgi_pass 
"unix:/var/www/vhosts/system/subdomain.example.com/php-fpm.sock";
                   include /etc/nginx/fastcgi.conf;
   
           }
   
           location ~ ^/~(.+?)(/.*)?$ {
                   proxy_pass https://[2a01:4f9:xx:xxxx::2]:7081;
                   proxy_hide_header upgrade;
                   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_set_header X-Accel-Internal 
/internal-nginx-static-location;
                   access_log off;
   
           }
   
           location ~ \.php(/.*)?$ {
                   fastcgi_read_timeout 3600;
                   fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                   try_files $uri $fastcgi_script_name =404;
                   fastcgi_param PATH_INFO $fastcgi_path_info;
                   fastcgi_pass 
"unix:/var/www/vhosts/system/subdomain.example.com/php-fpm.sock";
                   include /etc/nginx/fastcgi.conf;
   
           }
   
           add_header X-Powered-By PleskLin;
   
           include 
"/var/www/vhosts/system/subdomain.example.com/conf/vhost_nginx.conf";
   }
   
   server {
           listen 135.181.x.x:80;
   
           server_name subdomain.example.com;
           server_name www.subdomain.example.com;
           server_name ipv4.subdomain.example.com;
   
           client_max_body_size 128m;
   
           proxy_read_timeout 3600;
   
           # mailconfig
           location ~* ^/autodiscover/autodiscover\.xml$ {
                   try_files $uri @mad;
           }
           location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
                   try_files $uri @mad;
           }
   
           location  ~* ^/email\.mobileconfig$ {
                   try_files $uri @mad;
           }
   
           location @mad {
                   rewrite ^(.*)$ /mailconfig/ break;
   
                   proxy_pass                          http://127.0.0.1:8880;
                   proxy_set_header X-Host             $host;
                   proxy_set_header X-Request-URI      $request_uri;
           }
           # mailconfig
   
           location / {
                   return 301 https://$host$request_uri;
           }
   }
   
   server {
           listen [2a01:4f9:xx:xxxx::2]:80;
   
           server_name subdomain.example.com;
           server_name www.subdomain.example.com;
           server_name ipv6.subdomain.example.com;
   
           client_max_body_size 128m;
   
           proxy_read_timeout 3600;
   
           # mailconfig
           location ~* ^/autodiscover/autodiscover\.xml$ {
                   try_files $uri @mad;
           }
           location ~* ^(/\.well-known/autoconfig)?/mail/config\-v1\.1\.xml$ {
                   try_files $uri @mad;
           }
   
           location  ~* ^/email\.mobileconfig$ {
                   try_files $uri @mad;
           }
   
           location @mad {
                   rewrite ^(.*)$ /mailconfig/ break;
   
                   proxy_pass                          http://127.0.0.1:8880;
                   proxy_set_header X-Host             $host;
                   proxy_set_header X-Request-URI      $request_uri;
           }
           # mailconfig
   
           location / {
                   return 301 https://$host$request_uri;
           }
   }
   ```
   
   </details>
   </summary>
   
   
   <summary> new vhost_nginx.conf
   <details>
   
   ```
   pagespeed on;
   pagespeed Domain http*://*.example.com;
   pagespeed Disallow "*.js";
   
   location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
           add_header "" "";
   }
   location ~ "^/pagespeed_static/" { }
   location ~ "^/ngx_pagespeed_beacon$" { }
   location /ngx_pagespeed_statistics { allow 127.0.0.1;  deny all; }
   location /ngx_pagespeed_global_statistics { allow 127.0.0.1;  deny all; }
   location /ngx_pagespeed_message { allow 127.0.0.1;  deny all; }
   location /pagespeed_console { allow 127.0.0.1;  deny all; }
   location ~ ^/pagespeed_admin { allow 127.0.0.1;  deny all; }
   location ~ ^/pagespeed_global_admin { allow 127.0.0.1;  deny all; }
   ```
   
   </details>
   </summary>
   
   On the frontend I see only a single image converted to webp but no others 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@pagespeed.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to