Answer the question
In order to leave comments, you need to log in
How to load html cache from external nginx server?
Friends, for some time now I have been trying to find a solution for loading the cache through the domain. I use the Super Cache plugin in WordPress.
Now the files are loaded by the line from the main domain example.tdl :
# Если кеша нет, тогда отправляемся к WordPress, чтобы он его нам создал
location / {
index index.php index.html;
try_files /wp-content/cache/supercache/${http_host}${cache_uri}index.html /wp-content/cache/supercache/${http_host}${cache_uri}index-https.html $uri $uri/ /index.php?$args ;
}
Answer the question
In order to leave comments, you need to log in
server {
server_name cdn.example.tdl;
# тут проверяешь наличие кэша, если файла нет, то сработает @redirect
location / {
try_files /wp-content/cache/supercache/${http_host}${request_uri}index.html @redirect;
}
# перенаправление на основной домен
location @redirect {
return 301 http://example.tdl$request_uri;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question