• Home
  • 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

Hearing aid listed company official website SEO case

2023-05-23

how to use docker to run php5.6 plus apache

2023-05-15

Running the Apache HTTP Server with PHP inside Docker

2023-05-15
Facebook Twitter Instagram
  • 中文
  • English
Facebook Twitter Instagram Pinterest VKontakte
SEO & Website build tips SEO & Website build tips
  • Home
  • About Us
  • Services
    • SEO Services
    • Website Design Service
  • Projects
  • Docs
  • Blog
    • Affiliate
    • Ecommerce
    • Frontend
    • linux
      • nginx
    • PHP
      • Magento
      • wordpress
    • Python
    • SEO
    • Web
  • Contact Us
SEO & Website build tips SEO & Website build tips
Home»nginx»using simply static and wp rocket together to boost your website speed
nginx

using simply static and wp rocket together to boost your website speed

OxfordBy Oxford2019-12-08No Comments2 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest Email

#https://www.vpseo.com/2019/10/16/wp-super-cache-and-nginx-config/
#https://www.vpseo.com/2019/09/06/wp-rocket%E9%85%8D%E5%90%88nginx%E5%AE%9E%E7%8E%B0%E7%BA%AF%E9%9D%99%E6%80%81%E5%8C%96%E5%8A%A0%E9%80%9Fwordpress%EF%BC%8Crocket-nginx/

now you can use the simply static and wp-rocket plugin together.   below code is edit base on wp supercache .  I modified it , and make it works on simply static and wp-rocket plugin.

server {
        listen *:80;
        listen [::]:80;
        server_name 9wp.net tripdir.com armstrong-mec.com;
        return 301 http://www.$host$request_uri;
}


server {

        listen *:80;
        listen [::]:80;
        server_name www.9wp.net www.tripdir.com www.armstrong-mec.com;

        root  /var/www/vhosts/$host;
        index index.html index.htm index.php;

# Rocket-Nginx configuration , you can remove below line , if don't installed the rocket-nginx
include /usr/local/nginx/rocket-nginx/default.conf;

# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#location / {
#try_files $uri $uri/ /index.php?q=$uri&$args;
#}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}


# WP Super Cache config.
# Designed to be included from a 'wordpress-ms-...' configuration file.
set $cache_uri $request_uri;

# POST 的 and get don't cache
if ($request_method = POST) {
        set $cache_uri 'null cache';
}

if ($query_string != "") {
        set $cache_uri 'null cache';
}

# dont't cache below file , dont't cache pictures , so you no need to generate image , that can save your disk place.
if ($request_uri ~* "(/wp-content/|/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
        set $cache_uri 'null cache';
}

#don't cache logged users
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
        set $cache_uri 'null cache';
}


# use simply static html first then wp-rocket php.
location / {
        try_files /static/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt  { log_not_found off; access_log off; }
 # Cache static files for as long as possible


        location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2)$ {
                 expires 30d;
                 add_header Cache-Control "public, no-transform";
        }

        location ~*  \.(pdf|css|html|js|swf)$ {
                expires 2d;
        }

        location ~* .(eot|ttf|woff|svg|otf)$
          {
                add_header Access-Control-Allow-Origin *;
        }

}
Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Avatar photo
Oxford

Related Posts

Add custom field to Woocommerce tab

2022-03-07

Surror Product Tabs for WooCommerce

2022-03-07

make wordpress static with gatsby

2021-09-29

WP Remote Users Sync – manage multi wordpress website easy

2021-08-01
Recent Posts
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
  • Running the Apache HTTP Server with PHP inside Docker
  • VideoJS – multiple source demo
  • Add custom field to Woocommerce tab
December 2019
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
« Nov   Jan »
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
  • Hearing aid listed company official website SEO case
  • how to use docker to run php5.6 plus apache
  • Running the Apache HTTP Server with PHP inside Docker
  • VideoJS – multiple source demo
  • Add custom field to Woocommerce tab
From Flickr
Website Design Case
© 2023 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.