I'm new with Webfaction and I know from experience that I'll need a reverse proxy to cache my site. Is there a preferred reverse proxy cache solution to use with Webfaction? My app with be a straight Static/CGI/PHP app. I searched the docs and the forum and didn't find anything appropriate. asked 24 Sep '11, 08:45 carbonsink |
Yes, it sounds to me like you'll need a reverse proxy like Varnish or Squid. You should be able to build either of those from source and run it as a custom application - but we don't have a way for you to use them to cache a site served by our shared Apache instance (ie the Apache that serves Static/CGI/PHP applications. To work around that, you can build your own Apache+PHP stack from source and use that to serve your sites along with your caching proxy. Beyond that, we don't have any step-by-step instructions, mainly because nobody's really raised this issue before. Feel free to ask any questions if you run into problems as you set things up. answered 24 Sep '11, 13:09 seanf Thanks Sean. It seems that I also need a custom Apache+PHP stack in order to use memcached with PHP: http://community.webfaction.com/questions/1842/memcached-and-php But if I go that route I lose the nice WebFaction control panel app to create apps/sites, right? And I've got to build my own cron-based restart script to ensure my custom app will restart automatically if it goes down, right? Caching is important to keep the load on the servers reasonable but WebFaction doesn't provide any of the tools to do that, at least not with a Static/CGI/PHP site.
(24 Sep '11, 18:59)
carbonsink
No and yes :) You can still create apps via the control panel, and you can still create sites via the control panel, but you also need to do a bit of extra work to configure your private Apache to serve your sites. The general steps are:
Once that's done, requests for the domain will go to your Apache, which will then serve whatever app based on the VirtualHost you created.
Yes, but that's pretty easy. Here, take mine:
Hope that helps!
(24 Sep '11, 19:07)
seanf
Almost there. Here's the part I don't completely understand: I have a private Apache successfully listening on localhost at the randomly assigned port but how will I get the reverse proxy to listen on 184.172.207.69 port 80 without conflicting with other users?
(24 Sep '11, 20:40)
carbonsink
You can not get your reverse proxy to listen at the port 80 as our frontend server runs on that server but instead you can setup a custom app(running on port) for it and run the app on the assigned port. You should then mount that app on your site instead of the phpstack and point to the stack app internally in your reverse proxy's configuration.
(24 Sep '11, 21:06)
neeravk
"You should then mount that app on your site" - yes, thanks, but how does one mount an app that's running on a port other than 80? Specifically, its running at 127.0.0.1:41538.
(24 Sep '11, 22:58)
carbonsink
You can just add it to your site record at the URL path /. The control panel will automatically configure the frontend server to proxy to the correct port.
(24 Sep '11, 23:01)
neeravk
Got it now. The phpstack shows up automagically in the app list then I link a website to it. Thanks much for your help.
(24 Sep '11, 23:04)
carbonsink
showing 5 of 7
show 2 more comments
|
Just to document the gotcha that got me... I chose to install Varnish, from source, and chose to use their compile method which differed slightly from WebFaction's instructions:
The 'make' line caused unrecoverable errors with 'libtool'. Eventually this is what solved it: not using the Varnish supplied libtool but using the one already installed on the machine:
I now have Varnish installed as a custom app on an assigned localhost port accepting requests from WebFaction's nginx and passing those requests to phpstack (custom installed Apache/PHP) on a different assigned localhost port. I hope this info helps someone else. answered 26 Sep '11, 19:18 carbonsink Thanks for the tip! I was having the same error and this solved it.
(17 Jan '12, 07:21)
robflaherty
|
Please check our documentation on serving static media: http://docs.webfaction.com/software/static.html#serving-static-media
Making a "Static only" app will ensure that the files are served via the frontend Nginx server and are not forwarded to the backend Apache server.
If this is not what you had in mind, please elaborate. Are perhaps you trying to set up the static portion of your site to run through a third-party CDN?
Thanks for the reply.
What I want to do is cache dynamic pages for 10 minutes so that they aren't being regenerated constantly. I believe that a caching reverse proxy is the tool for this job, would you/anyone concur?