Now that I had this test bed for new hotness running the new hotness, I decided I should get the caching working again.
Well, this is 2.0 of the code. This seems to work a lot better (like, works in general).
server {
listen 80;
server_name some_spiffy_name;
root /wheremyappis/public;
access_log /somelogfile.access.log main;
error_log /someotherlog.error.log notice;
client_max_body_size 50M;
passenger_enabled on;
location /assets/ {
rewrite ^/assets/(.*)$ /assets/$http_host/$1 break;
}
location /cache/ {
rewrite ^/cache/(.*)$ /cache/$http_host$1 break;
}
}
And, as an added bonus, it’s much easier to read!
Thanks to mibb in IRC , we were able to hack the following out:
server {
listen 80;
server_name d;
access_log ;
error_log ;
root ;
passenger_enabled on;
location /assets/ {
rewrite ^/assets/(.*)$ /assets/$http_host/$1 break;
}
# this appears to be broken
# / -> index.html
# if (-f $document_root/cache/$host$uri/index.html) {
# rewrite (.*) /cache/$host$1/index.html break;
# }
# /about -> /about.html
if (-f $document_root/cache/$host$uri.html) {
rewrite (.*) /cache/$host$1.html break;
}
# other files
if (-f $document_root/cache/$host$uri) {
rewrite (.*) /cache/$host$1 break;
}
}