From 50554b220da42ae7472cb6156d1edbc7f143b7a9 Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Jul 21 2015 14:17:34 +0000 Subject: Add apache example --- diff --git a/README.rst b/README.rst index b950a2b..7c7841b 100644 --- a/README.rst +++ b/README.rst @@ -58,6 +58,21 @@ example: `/static//`. +Production: +----------- + +Note that this is most likely less efficient than having apache serve the static +files itself, but even if you do that you might want to have multiple static +directories and have apache fallback. + +In this case, you can use the example.conf file that is shipped as part of this +repository. + +The example.conf file has an example configuration that will try to serve a file +from an instance-specific theme directory, and only if the file was not found, fall +back to the application default theme. + + License: -------- diff --git a/example.conf b/example.conf new file mode 100644 index 0000000..e68813f --- /dev/null +++ b/example.conf @@ -0,0 +1,18 @@ +# Example httpd config with two fallbacks +# +# Distributed under the CC0 license. +# You can find a copy of this license at +# http://creativecommons.org/publicdomain/zero/1.0/ +# +# To the extend possible under law, the author has +# waived all copyright and related or neighboring +# rights on this work. +# +RewriteEngine on + +# First try the instance-specific theme +RewriteCond "/srv/approot/static/my_theme/$1" -f +RewriteRule "^/static/(.*)" "/srv/approot/static/my_theme/$1" [L] + +# Use the application default theme for files not customized +RewriteRule "^/static/(.*)" "/srv/approot/static/default/$1" [L]