• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue Serve static assets with an efficient cache policy on nginx server

Marian97c

New Pleskian
Hello, I have a problem with
Serve static assets with an efficient cache policy, which shows me in page speed test by Google, can you help me fix the problem?

Issue
vQQbfYS.png

Settings
D4nyLxU.png

Additional nginx directives

Code:
# Enable Gzip compression
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
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
text/xml
text/javascript;

# Cache static files
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf|webp)$ {
    add_header "Access-Control-Allow-Origin" "*";
    access_log off;
    log_not_found off;
    expires 30d;
}

Serve static files directly by nginx - ACTIVATED
Code:
ac3 avi bmp bz2 css cue dat doc docx dts eot exe flv gif gz htm html ico img iso jpeg jpg js mkv mp3 mp4 mpeg mpg ogg pdf png ppt pptx qt rar rm svg swf tar tgz ttf txt wav woff woff2 xls xlsx zip webp

Htaccess in attach files


I also use wp rocket and I installed the wp rocket module on the server, I think I have to add something in the directives but I'm not sure.

I am a beginner and I want help, probably htaccess is inappropriate, please offer me a better option, if possible.

Don't throw stones and post only if you can help me. Thanks!
 

Attachments

  • htaccess].zip
    3.2 KB · Views: 16
This is the top search on google when you search for this issue and its bugging me that it was never answered!

Here are my setting below that work for me using a WordPress site.

On Proxy Mode

On Smart static files processing

On Serve static files directly by nginx
Remove all but below
ac3 avi cue dat docx dts eot exe htm html img iso mkv mp3 mp4 mpeg mpg ogg pptx qt rm xls xlsx zip webp

Off Enable nginx caching (though I don't think it matters)

Additional nginx directives
location ~* \.(js|jpg|jpeg|gif|png|css|tgz|gz|rar|bz2|doc|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|woff|woff2|svg|webm|ttf|otf|min)$ {
etag on;
if_modified_since exact;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}
 

Attachments

  • Screenshot 2021-10-13 at 11.25.04.png
    Screenshot 2021-10-13 at 11.25.04.png
    591.7 KB · Views: 76
Hi people. Did anybody get any further with this one? I am being hit with "Serve static assets with an efficient cache policy" throughout all my Wordpress sites too.

Anybody aware of additional Nginx directives to appease Google insights reports?

I usually run with the attached by default.

Plesk is on latest 18.0.52
CentOS 7.9
 

Attachments

  • Screenshot 2023-06-15 at 16.27.59.png
    Screenshot 2023-06-15 at 16.27.59.png
    276.8 KB · Views: 16
Back
Top