Monday, May 3, 2010

Deployment Newbie

I've been trying to get our Pinax-based web application on our web server for the past few days. As a Master's student, I have had experience working with web frameworks but I've never had to deploy them. So dealing with the httpd.conf, .htaccess, and various permissions errors tripped me up big time. Thankfully, I've had the benefit of both Google and colleagues. Hopefully, other newbie deployers will find my foray into Apache and mod_wsgi useful.

Permission Denied: /Users/username/.htaccess pcfg_openfile?

So I got this error. A lot. And I couldn't quite figure out why. Everything I read from Google lead me to think that I had permissions errors somewhere in directory. But I changed everything to 755 and it still didn't seem to work. So I asked Robert, a colleague, and he asked me to check my home directory. The permissions on my home directory were 700. Robert mentioned that since Apache needs to go in, it needs access to the files. So once I 'chmodded' those, things started to work.

I had a few errors after that, but they were mostly related to permissions on the project file (they should all be 755).

Setting Up Virtual Hosts:

This was a real newbie mistake. Most of the tutorials I've seen online for Pinax deployment don't mention virtual hosts. And if they do, the code sample is basically about what to put in the VirtualHost definition. Of course, being a newbie, I thought "Hey, I can change this to be any port that I want and it'll just work!" After looking through Apache's examples, I noticed that I was missing Listen and NameVirtualHost statements. So, the actual configuration would look something like (assuming you're using mod_wsgi):



Just put this in a configuration file, edit the paths, and point to it from the httpd.conf with an Include statement and things should work! I've got to admit that it could've been a lot more painful if Pinax did not provide the WSGI script.

But after all this, I got it to work, at least on my Mac through Apache. Now to put it on our web server.