Skip to content

Instantly share code, notes, and snippets.

@caquino
Last active December 31, 2020 17:24
Show Gist options
  • Save caquino/5580730 to your computer and use it in GitHub Desktop.
Save caquino/5580730 to your computer and use it in GitHub Desktop.
Poors Main ESI
Cached: <!--# echo var="date_local" -->
Uncached: <!--# echo var="date_local" -->
Main: <!--# echo var="date_local" -->
<!--# block name="cached" --> <!--# endblock -->
<!--# include virtual="/cached/" stub="cached" -->
<!--# block name="uncached" --> <!--# endblock -->
<!--# include virtual="/uncached/" stub="uncached" -->
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=default:10m;
server {
listen 80;
server_name localhost;
location / {
ssi on;
proxy_cache default;
proxy_cache_valid 5m;
proxy_pass http://localhost:81;
}
location /uncached {
ssi on;
proxy_pass http://localhost:81;
}
}
server {
listen 81;
server_name localhost;
index index.shtml;
root /var/www;
location /cached {
ssi on;
}
}
root@server:~# wget -q -O - http://localhost/
Main: Tuesday, 14-May-2013 22:01:07 BRT
Cached: Tuesday, 14-May-2013 21:59:41 BRT
Uncached: Tuesday, 14-May-2013 22:01:07 BRT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment