0

I have a shared hosting server with some 2000 websites on it.

I have a lightweight apache/event frontend that takes care of static content and locally proxies requests for dynamic content to a heavyweight apache/prefork/mod_php backend.

This is the regex I am using at the moment

ProxyPassMatch .*\.(?i)(avi|bmp|css|flv|gho|gif|ico|iso|jpg|jpeg|js|mkv|mp4|pdf|png|rar|swf|tiff|txt|zip)$ !
ProxyPassReverse / http://%{HTTP_HOST}:8080/
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/

However I am considering switching to this regex

(\.php|\/|\.html|^[^.]+|\.htm)$

This would proxy the following

1) anything.php

2) / or /anything/

3) anything.html

4) anything

5) anything.htm

but not the following

1) anything.PHP

2) anything.jpg

3) anything.anything

which is exactly what I want.

Can you come up with a more efficient solution to proxy anything that should be treated as dynamic content?

0

I'd put the static content in a separate directory instead. That way you won't be tied to filenames in case you want to add some new kind of content to not be proxied.

  • sorry Jenny, I should have mentioned this is for a shared hosting server. – wlf Oct 24 '13 at 11:22
  • You did...but it would still be possible to have your users use a particular path for static content and do a ProxyPassMatch that excludes that directory. – Jenny D Oct 24 '13 at 11:47
  • I thought about this, the problem is that each website is built on a different CMS Joomla, phpBB, WordPress to name but a few. These have images all over the place... some of them even place images/PHP files in the same directories. – wlf Oct 24 '13 at 12:56
  • Then I can't think of something better at the moment; it's a bit too late to suggest that your customers change their entire setup... – Jenny D Oct 24 '13 at 13:31
  • Actually, now I can think of something better. Instead of not proxying, you could cache the files that shouldn't be proxied. – Jenny D Oct 24 '13 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.