Thursday, July 21, 2011

Setting up a virtual Apache server

Holy shit, 10 days without a blog post? Fear not, I have been coding! Just not writing about coding.

So here's where I'm at now. I'm near the end of the practical section of Agile Web Development. The chapter I'm on now is about deployment and I'm having trouble setting up a virtual Apache server and actually getting Depot to deploy. Everything appears to be installed correctly, but I can't get everything tied together correctly.

How do I find my host name? I'll need to define it as depot.hostname.com in my Apache configuration file. I thought it would just be depot.localhost.com, or perhaps depot.127.0.0.1.com, but neither of those worked.

I also had trouble editing my hosts file. I'm able to open it through the terminal, but it won't allow me to make changes.

Still, this headache is a minor set back. I know it's something I need to learn, but for now I think learning more actual coding will be more useful to me. Any good recommendations for new books? I really liked Agile Web Development, so I might look into something else by the Pragmatic Programmers. Not sure if Advanced Rails Recipes would be beyond me or not.

2 comments:

  1. Clarification, I think you're setting up a Name Based Virtual Host with Apache.

    It sounds like you are deploying to your own machine, where the code already lives. This is an interesting exercise in setting up Apache for a Rails project, but it is highly unlikely that you actually want to deploy to your own machine. I would strongly suggest using Heroku and skipping this step entirely, but if you must I'll give you some pointers.

    127.0.0.1 is the IP address that means "this machine" it's a relative term, it always means the machine that it's running from. localhost is the hostname that means exactly the same thing. In fact when you resolve the localhost you actually get 127.0.0.1. Most programs allow hostnames and ip addresses to be used interchangeably, but they are different things.

    Your hosts file is not writable by your regular user account. This is a security measure that makes a lot more sense on a machine that has many users. If you "become root" using the su or sudo commands, you will have full access to these things. Probably easier is to just open the file with TextMate which will do this for you as needed.

    ReplyDelete
  2. @Eli Yeah, it's a Name Based Virtual Host. I think you're right and using Heroku is what I should be doing instead. Heroku's something I need to learn anyway, and if I'm going to deal with deploying and server-related headaches, it might as well be the most useful headache possible.

    I plan to look into Heroku this weekend as well as decide on the next book I want to get. Probably something Ruby related, I need to work on those skillz!

    ReplyDelete