We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
NGINX/PHP-FM Wordpress & Wp-Super-Cache
NGINX/PHP-FM Wordpress & Wp-Super-Cache
Помогите пожалуйста, не работает Wp-super-cache, не кэширует вообще, ноль файлов.
Centos7, Nginx/PHP-FM, Wordpress Multisite на поддоменах.
Все работает, nginx запускается, но Wp-Super-Cache не кэширует.
Вот мой темплейт на базе wordpress2_rewrite.stmpl
Centos7, Nginx/PHP-FM, Wordpress Multisite на поддоменах.
Все работает, nginx запускается, но Wp-Super-Cache не кэширует.
Вот мой темплейт на базе wordpress2_rewrite.stmpl
Code: Select all
server {
listen %ip%:%web_ssl_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
set $cache_uri $request_uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
if ($query_string != "") {
set $cache_uri 'null cache';
}
# Don't cache uris containing the following segments
if ($request_uri ~* "(/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 use the cache for logged-in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+
|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}
# Set the cache file
set $cachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html";
set $gzipcachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html.gz";
if ($https ~* "on") {
set $cachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index-https.html";
set $gzipcachefile "/wp-content/cache/supercache/$http_host/$cache_uri/index.html.gz";
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
try_files $uri $uri/ /index.php?$args;
access_log off;
log_not_found off;
}
location / {
# Try in the following order: (1) gzipped cachefile, (2) cachefile, (3) normal url, (4) php
try_files $gzipcachefile $cachefile $uri $uri/ /index.php?$args;
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_cache microcache;
fastcgi_cache_key $scheme$host$request_uri$request_method;
fastcgi_cache_valid 200 301 302 30s;
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
if ($http_user_agent ~ "Python-urllib|Spinn3r|SISTRIX|Morfeus|Toata|QuerySeekerSpider|JikeSpider|proximic|Sosospider|Sogou web spider|aesop_com_spiderman|alexibot|backweb|batchftp|bigfoot|black.hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye|cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck|cosmos|crescent|custo|da|diibot|disco|dittospyder|dragonfly|drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon|emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky|frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet|grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot|infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar|joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb|likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|markwatch|mata.hari|memo|microsoft.url|midown.tool|miixpc|mirror|missigua|mister.pix|moget|mozilla.newt|nameprotect|navroad|backdoorbot|nearsite|net.?vampire|netants|netcraft|netmechanic|netspider|nextgensearchbot|attach|nicerspro|nimblecrawler|npbot|octopus|offline.?explorer|offline.navigator|openfind|outfoxbot|pagegrabber|papa|pavuk|pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebwalker|psbot|pump|queryn|recorder|realdownload|reaper|reget|true_robot|repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|smartdownload|snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqworm|superbot|superhttp|surfbot|asterias|suzuran|szukacz|takeout|teleport|telesoft|the.intraformant|thenomad|tighttwatbot|titan|urldispatcher|turingos|turnitinbot|urly.warning|vacuum|vci|voideye|whacker|libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyborg|anonymouse|zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|sauger|site.quester|whack|craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|grabber|webpictures|Jakarta|libwww|lwp-trivial|PHPCrawl|WEP Search|Missigua Locator|ISC Systems iRc|Aboundex|360Spider|Java|Cogentbot|BunnySlippers|Cegbfeieh|AIBOT|Demon|Devil|Wonder|Foobot|Kenjin Spider|Density|LinkextractorPro|LWP::Simple|MassDownloader|Mass Downloader|NetZIP|NG|Metasearch|WebFetch|WebCopier|Webclipping|WebBandit|WebAuto|WebGo|Web.Image.Collector|WebLeacher|WebmasterWorldForumBot|WebReaper|WebSauger|eXtractor|Webster|WebStripper|WebWhacker|WebZIP|Catall Spider|AcoiRobot|rogerbot|MJ12bot|Ahrefsbot|dobot|MegaIndex.ru|SemrushBot|LinkpadBot|Zite|TweetmemeBot|woriobot|topsy|js-kit|NING") {return 403;}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
}
Re: NGINX/PHP-FM Wordpress & Wp-Super-Cache
мне удалось скрестить wp super cache+nginx/php-fpm но костыль еще тот=)) nginx+wp super cache не самое удачное решения.
Re: NGINX/PHP-FM Wordpress & Wp-Super-Cache
Да вот поставил сейчас Cache Enabler plugin.
Но тоже не работает.
В nginx.conf добавил
Но тоже не работает.
Code: Select all
server {
listen %ip%:%web_ssl_port% ssl http2;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
ssl on;
ssl_certificate %ssl_pem%;
ssl_certificate_key %ssl_key%;
# CacheEnabler Start
set $cache_uri $request_uri;
# bypass cache if POST requests or URLs with a query string
if ($request_method = POST) {
set $cache_uri 'nullcache';
}
if ($query_string != "") {
set $cache_uri 'nullcache';
}
# bypass cache if URLs containing the following strings
if ($request_uri ~* "(/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 'nullcache';
}
# bypass cache if the cookies containing the following strings
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'nullcache';
}
# default html file
set $cache_enabler_uri '/wp-content/cache/cache-enabler/${http_host}${cache_uri}index.html';
# webp html file
if ($http_accept ~* "image/webp") {
set $cache_enabler_uri '/wp-content/cache/cache-enabler/${http_host}${cache_uri}index-webp.html';
}
# CacheEnabler Stop
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
try_files $uri $uri/ /index.php?$args;
access_log off;
log_not_found off;
}
location / {
try_files $cache_enabler_uri $uri $uri/ /index.php?$args;
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_cache microcache;
fastcgi_cache_key $scheme$host$request_uri$request_method;
fastcgi_cache_valid 200 301 302 30s;
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_pass_header Set-Cookie;
fastcgi_pass_header Cookie;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass %backend_lsnr%;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
if ($http_user_agent ~ "Python-urllib|Spinn3r|SISTRIX|Morfeus|Toata|QuerySeekerSpider|JikeSpider|proximic|Sosospider|Sogou web spider|aesop_com_spiderman|alexibot|backweb|batchftp|bigfoot|black.hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye|cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck|cosmos|crescent|custo|da|diibot|disco|dittospyder|dragonfly|drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon|emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky|frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet|grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot|infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar|joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb|likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|markwatch|mata.hari|memo|microsoft.url|midown.tool|miixpc|mirror|missigua|mister.pix|moget|mozilla.newt|nameprotect|navroad|backdoorbot|nearsite|net.?vampire|netants|netcraft|netmechanic|netspider|nextgensearchbot|attach|nicerspro|nimblecrawler|npbot|octopus|offline.?explorer|offline.navigator|openfind|outfoxbot|pagegrabber|papa|pavuk|pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebwalker|psbot|pump|queryn|recorder|realdownload|reaper|reget|true_robot|repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|smartdownload|snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqworm|superbot|superhttp|surfbot|asterias|suzuran|szukacz|takeout|teleport|telesoft|the.intraformant|thenomad|tighttwatbot|titan|urldispatcher|turingos|turnitinbot|urly.warning|vacuum|vci|voideye|whacker|libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyborg|anonymouse|zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|sauger|site.quester|whack|craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|grabber|webpictures|Jakarta|libwww|lwp-trivial|PHPCrawl|WEP Search|Missigua Locator|ISC Systems iRc|Aboundex|360Spider|Java|Cogentbot|BunnySlippers|Cegbfeieh|AIBOT|Demon|Devil|Wonder|Foobot|Kenjin Spider|Density|LinkextractorPro|LWP::Simple|MassDownloader|Mass Downloader|NetZIP|NG|Metasearch|WebFetch|WebCopier|Webclipping|WebBandit|WebAuto|WebGo|Web.Image.Collector|WebLeacher|WebmasterWorldForumBot|WebReaper|WebSauger|eXtractor|Webster|WebStripper|WebWhacker|WebZIP|Catall Spider|AcoiRobot|rogerbot|MJ12bot|Ahrefsbot|dobot|MegaIndex.ru|SemrushBot|LinkpadBot|Zite|TweetmemeBot|woriobot|topsy|js-kit|NING") {return 403;}
location /vstats/ {
alias %home%/%user%/web/%domain%/stats/;
include %home%/%user%/web/%domain%/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
}
Code: Select all
# File cache settings
open_file_cache max=10000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
fastcgi_cache_path /var/cache/nginx/fcgi levels=1:2 keys_zone=microcache:10m max_size=1024m inactive=1h;