• Home
    • English
    • 中文
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us

Subscribe to Updates

Get the latest creative news from FooBar about art, design and business.

What's Hot

Design a plugin for wordpress woocommerce to display a tab to show attachment download

2024-04-06

TranslatePress v2.6.9 – WordPress Translation Plugin

2023-12-25

A Linux batch script converting pictures to webp format

2023-07-10
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram Pinterest VKontakte
Weilai Tech Weilai Tech
  • Home
    • English
    • 中文
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us
Weilai Tech Weilai Tech
Home»nginx»how to setup W3 total cache on nginx server
nginx

how to setup W3 total cache on nginx server

OxfordBy Oxford2021-05-02No Comments1 Min Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

If you visit your-domain.com/wp-admin/admin.php?page=w3tc_install W3 Total Cache will show you all the additional configuration information that you need. Included in that information will be some Nginx configurations which I’ve also listed below. Copy and paste it into your WordPress installation’s Nginx server block (a.k.a VirtualHosts).

# BEGIN W3TC Minify cache
location ~ /wp-content/cache/minify.*\.js$ {
    types {}
    default_type application/x-javascript;
    add_header Vary "Accept-Encoding";
}
location ~ /wp-content/cache/minify.*\.css$ {
    types {}
    default_type text/css;
    add_header Vary "Accept-Encoding";
}
location ~ /wp-content/cache/minify.*js\.gzip$ {
    gzip off;
    types {}
    default_type application/x-javascript;
    add_header Vary "Accept-Encoding";
    add_header Content-Encoding gzip;
}
location ~ /wp-content/cache/minify.*css\.gzip$ {
    gzip off;
    types {}
    default_type text/css;
    add_header Vary "Accept-Encoding";
    add_header Content-Encoding gzip;
}
# END W3TC Minify cache
# BEGIN W3TC Browser Cache
gzip on;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
# END W3TC Browser Cache
# BEGIN W3TC CDN
location ~ \.(ttf|ttc|otf|eot|woff|font.css)$ {
   add_header Access-Control-Allow-Origin "*";
}
# END W3TC CDN
# BEGIN W3TC Minify core
rewrite ^/wp-content/cache/minify.*/w3tc_rewrite_test$ /wp-content/plugins/w3-total-cache/pub/minify.php?w3tc_rewrite_test=1 last;
set $w3tc_enc "";
if ($http_accept_encoding ~ gzip) {
    set $w3tc_enc .gzip;
}
if (-f $request_filename$w3tc_enc) {
    rewrite (.*) $1$w3tc_enc break;
}
rewrite ^/wp-content/cache/minify/(.+/[X]+\.css)$ /wp-content/plugins/w3-total-cache/pub/minify.php?test_file=$1 last;
rewrite ^/wp-content/cache/minify/(.+\.(css|js))$ /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1 last;
# END W3TC Minify core



https://www.digitalocean.com/community/questions/w3-total-cache-with-nginx-config
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Avatar photo
Oxford

Related Posts

Design a plugin for wordpress woocommerce to display a tab to show attachment download

2024-04-06

TranslatePress v2.6.9 – WordPress Translation Plugin

2023-12-25

Add custom field to Woocommerce tab

2022-03-07

Surror Product Tabs for WooCommerce

2022-03-07
Recent Posts
  • Design a plugin for wordpress woocommerce to display a tab to show attachment download
  • TranslatePress v2.6.9 – WordPress Translation Plugin
  • A Linux batch script converting pictures to webp format
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
May 2021
M T W T F S S
 12
3456789
10111213141516
17181920212223
24252627282930
31  
« Apr   Jun »
Tags
app branding design digital Docly docs etc faq fix github Helpdesk Image issue magento Manual marketing memecached Photography planing seo sequrity tips Travel ui/ux web WordPress 爬虫
Editors Picks
About Us

Guangzhou Weilai Technology is a foreign trade integrated marketing service provider focusing on Google as the drainage center and marketing self-built website as the carrier.

Email Us: [email protected]
Contact: +86 18676917505

Facebook Pinterest YouTube LinkedIn
Recent Posts
  • Design a plugin for wordpress woocommerce to display a tab to show attachment download
  • TranslatePress v2.6.9 – WordPress Translation Plugin
  • A Linux batch script converting pictures to webp format
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
From Flickr
Website Design Case
© 2024 Copyright by Guangzhou Weilai Technology Co.,Ltd..
  • Home
  • About Us
  • SEO Services
  • Website Design Service
  • Projects
  • Blog
  • Contact Us

Type above and press Enter to search. Press Esc to cancel.