• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Pass some specific file from nginx to Apache

Wp_SEO

New Pleskian
Hi all,
i'm using Plesk Onyx 17.8 configured with:
Apache with mod_pagespeed
nginx as reverse provxy
In the Apache side, mod_pagespeed provide to generate on the fly css and js optimized like this:

https://domain.com/wp-includes/css/dist/block-library/A.style.min.css.pagespeed.cf.cOBdefHnvQ.css

This url return a 404 error by nginx because nginx try to serve it (for it is a static css file).

If i change this url adding the Apache port it works correctly because will be serve from Apache:

https://domain.com:7081/wp-includes...y/A.style.min.css.pagespeed.cf.cOBdefHnvQ.css

If i check the proxy_error log i found this kind of row:

2019/04/14 00:16:19 [error] 3465#0: *24416 openat() "/var/www/vhosts/domain.it/httpdocs/wp-content/plugins/wysija-newsletters/css/A.validationEngine.jquery.css.pagespeed.cf.jcn-RfgU3K.css" failed (2: No such file or directory), client: 79.52.50.97, server: domain.it, request: "GET /wp-content/plugins/wysija-newsletters/css/A.validationEngine.jquery.css.pagespeed.cf.jcn-RfgU3K.css HTTP/2.0", host: "domain.it", referrer: "https://domain.it/"

where seems that ngix looking for real file on the filesystem.

The question is: how can i add rule in nginx to pass the process this kind of url to Apache?

I tried something like this:

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass https://domain:7081/$request_uri;
}

but seems to be ignored.

Thanks
 
Back
Top