WebFaction
Community site: login faq

I was wondering if it were possible to enable these options for a Django installation? With nginx serving up the static files, do we have any control over the configuration as we do with our apache instance?

asked 20 Nov '10, 17:12

bmeyer71 ♦♦
1.5k3613
accept rate: 33%


If you want to set caching options for your static files, then you need to serve them via a 'static/cgi/php' symlink (which understands .htaccess directives) instead of a 'static-only' symlink (which does not). You'll incur a small initial performance hit (since the files are served from our shared back-end Apache instance) but your overall performance will improve since your static files will be cached on the client side (assuming that's what you intend to do).

permanent link

answered 20 Nov '10, 17:38

seanf
12.2k41836
accept rate: 37%

Yes, my thought was to use client side caching more. Ok, so this bypasses using the nginx server. These .htaccess directives can also be placed in the httpd.conf file correct?

(20 Nov '10, 17:48) bmeyer71 ♦♦

If you are serving your static media from static/cgi/php app, then no, you cannot put your caching directives in your httpd.conf. You must put them in a htaccess file in the static/cgi/php app's directory.

(20 Nov '10, 19:30) seanf

Ok, I gave that a try but not with any success. I added the following to .htaccess, but never saw an expiry time on the files.

    ExpiresActive On
    <filesmatch "\.(txt|xml|js|css)$"="">
    ExpiresDefault A604800
    </filesmatch>
Am I right to assume that this module is available?
(20 Nov '10, 21:45) bmeyer71 ♦♦

Ok, I think I have the Expires portion working now. I'm guessing it was placement of the rules in .htaccess. I recreated it with the following:

    <filesmatch "\.(css|ico|pdf|flv|jpg|jpeg|png|gif|js|swf)$"="">
        ExpiresActive On
        ExpiresDefault "access plus 1 week"
    </filesmatch>
(21 Nov '10, 17:25) bmeyer71 ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×908
×225
×186

question asked: 20 Nov '10, 17:12

question was seen: 4,970 times

last updated: 16 Jul '11, 10:35

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM