Hi, my site has been up and running fine for about 2 months now, and I have lately been trying to improve its performance with the help of YSlow. So I got a 2 Part question here. One point YSlow makes is that its best to put all static media on a subdomain on which cookies can be turned off. Currently, all of my static media is served on /media/ with a static app, but I had the idea that there must be some way I can set up http://media.mysite.com to point to http://www.mystite.com/media/. I could then set http://media.mysite.com as my static media domain in django. Is there any way I could do this? Next, and related to that, is setting up "expires" headers for my static image files. I tried adding this:
to the httpd.conf of my django app, but then I remembered that my static files were served with a static app. However, my static app does not have an httpd.conf. How can I set the expires headers for these files? asked 08 Oct '11, 11:30 germanjoey |
I don't see any need to point http://media.mysite.com at http://www.mystite.com/media/. You should just need to do this:
Regarding your expires headers, your static-only app is served by Nginx, so you cannot use Apache directives. Instead, you can edit your static-only app in our control panel to set "expires max" in the "extra info" field, and that will be applied to anything served from that app. "expires max" is the only option we support at this time. Hope that helps! answered 08 Oct '11, 14:44 seanf Well, the problem is that while most of my static media is done with django, there are a few places that are hardcoded. I would like it if I didn't have to go and find all of these scattered places. Is there any way to preserve both, like I mentioned in the original question?
(08 Oct '11, 16:10)
germanjoey
I also don't see an option to edit my static media app. Do I need to recreate it? Can I delete it without all of my static files being deleted too?
(08 Oct '11, 16:14)
germanjoey
Sure, you can continue to serve your existing static media app on http://www.mystite.com/media/ while also serving it via a separate site on http://media.mysite.com/ - so, the bits you don't change will still be able to find media at the old location.
No, you don't need to re-create it. If you delete it, your static files will be deleted, so don't do that either. You can edit the app by going to Apps in the control panel and then click the edit icon (the one with the pencil) on the row for whatever app.
(08 Oct '11, 16:20)
seanf
Well thanks seanf! I'll give this a try!
(08 Oct '11, 16:23)
germanjoey
seanf, I tried creating the subdomain but it seems to 404 on me. Does it take time for the new subdomain to show up?
(08 Oct '11, 17:07)
germanjoey
Yes, new subdomains always take a bit of time to propagate. If it's not working after several minutes have passed, then please try flushing your DNS cache as described the bottom of our domain docs and then try again.
(08 Oct '11, 17:34)
seanf
showing 5 of 6
show 1 more comments
|