Re: [Tiki-devel] Caching with Nginx
Fabio Montefuscolo <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.devel |
|---|---|
| Message-ID | <CAF4KPBSC0njnEwnzJpcbtP+zQRvpBQNxd7ib+tS11uz4GV84ig@mail.gmail.com> |
The following URLs are very interesting * https://dev.tiki.blue/AdminUIRevamp * https://dev.tiki.org/AdminUIRevamp On Fri, Jun 4, 2021 at 7:08 PM Fabio Montefuscolo < [email protected]> wrote: > The initial strategy can be using microcaching and stale cache feature. > > Microcaching would cache a resource just for few minutes, 1 or 5 minutes. > This way we avoid computing the same request that probably will deliver the > same resource in 5 minutes. > > We don't destroy the cache objects aging more than 5 minutes. We keep > there in case PHP or other upstream goes down. Then, instead serving an > error, we can deliver the old cache. > > Of course, that will depend on the business you are handling. Sometimes > the error is better than old info. > > > > > On Fri, Jun 4, 2021 at 6:58 PM Fabio Montefuscolo < > [email protected]> wrote: > >> Hello people! >> >> As I said before, Nginx is a great tool for caching. Just for fun, I >> tried to cache everything from dev.tiki.org, but proxying from my >> server. I have a domain, dev.tiki.blue proxying and caching dev.tiki.org. >> The first request to a page might be slow, the second is faster. >> >> Important things if someone wants to check >> >> * it is an experiment! >> * there are no rules to bypass the cache for GET methods ... so please DO >> NOT LOGIN there, otherwise, your private pages will be cached. >> * there is no cache to POST and PUT methods, so the search is not cached >> >> Not sure if attachments work here, so I am pasting the Nginx config below >> ... >> >> ------ >> proxy_cache_path /var/cache/devto-cache levels=1:2 keys_zone=DEVTO:50m >> max_size=10g inactive=1y use_temp_path=off; >> >> server { >> listen 80; >> server_name dev.tiki.blue; >> access_log /var/log/virtualmin/dev.tiki.blue_access_log; >> error_log /var/log/virtualmin/dev.tiki.blue_error_log; >> >> root /home/tiki/domains/dev.tiki.blue/public_html; >> index index.html index.htm index.php; >> >> location / { >> return 301 https://$server_name$request_uri; >> } >> } >> >> server { >> listen 443 ssl; >> server_name dev.tiki.blue; >> >> root /home/tiki/domains/dev.tiki.blue/public_html; >> index index.html index.htm index.php; >> access_log /var/log/virtualmin/dev.tiki.blue_access_log; >> error_log /var/log/virtualmin/dev.tiki.blue_error_log; >> >> set $skip_cache 0; >> >> proxy_cache_key "$scheme$request_method$host$request_uri"; >> proxy_cache DEVTO; >> proxy_cache_use_stale error updating timeout invalid_header >> http_500 http_503; >> proxy_cache_background_update on; >> proxy_cache_lock on; >> proxy_cache_valid 200 301 302 404 5m; >> proxy_buffers 16 16k; >> proxy_buffer_size 32k; >> proxy_ignore_headers Cache-Control Expires Set-Cookie; >> proxy_cache_bypass $skip_cache; >> proxy_no_cache $skip_cache; >> >> location / { >> expires 10m; >> add_header X-Cache $upstream_cache_status; >> add_header Last-Modified $upstream_http_date; >> proxy_set_header X-Real-IP $remote_addr; >> proxy_set_header Host "dev.tiki.org"; >> proxy_set_header Accept-Encoding ""; >> proxy_redirect ~^https?://dev\.tiki\.org(/.*) >> $scheme://$server_name$1; >> proxy_pass https://dev.tiki.org; >> subs_filter "https?://dev.tiki.org" " >> https://dev.tiki.blue" gr; >> } >> >> location = /tiki-login_scr.php { >> return 403; >> } >> location = /tiki-login.php { >> return 403; >> } >> >> ssl_certificate /home/tiki/domains/dev.tiki.blue/ssl.combined; >> ssl_certificate_key /home/tiki/domains/dev.tiki.blue/ssl.key; >> } >> > _______________________________________________ TikiWiki-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel