views:

150

answers:

4

In line with this question: http://stackoverflow.com/questions/171655/lightweight-web-app-server-for-php

The above question has been asked numerous times and answered exactly the same in all the cases I've found using google. My question is similar to a degree but with a different desired goal: On demand development instances.

I have come up with a somewhat questionable solution to host arbitrary directories in my user account for the purpose of development testing. I am not interested in custom vhosts but looking to emulate the behaviour I get when using paster or mongrel for Python & Ruby respectively.

Ubuntu 9.10 TOXIC@~/ >APACHE_RUN_USER=$USER APACHE_RUN_GROUP=www-data apache2 -d ~/Desktop/ -c "Listen 2990"

Is there a better solution, could I do something similar with nginix or lighttpd?

Note: The above won't work correctly for stock environments without a copied & altered httpd.conf.

Update: The ideal goal is to mimic Paster, Webbrick, and Mongrel for rapid local development hosting. For those light weight servers, it takes less then a minute to get a working instance running ( not factoring any DB support ). Apache2 vhost is great but I've been using Apache2 for over ten years and it would be some sort of abomination hack to setup a new entry in /etc/hosts unless you have your own DNS, in which case a wildcard subdomain setup would probably work great. EXCEPT one more problem, it's pretty easy for me to know what is being hosted ( ex. by paster or mongeral ) just doing a sudo netstat -tulpn while there would be a good possibility of confusion in figure out which vhost is what.

A: 

If you're looking for a lightweight solution only to save yourself time, I suggest you shouldn't.

You save time and probably lots and lots of headaches if you stick to the ol' LAMP software packages when it comes to development machines.

pestaa
My experience with working with Pylons and Rails says otherwise, its much more conveniant to be able to check a project out of source control and launch it immediately for access to some port then to check the code out, add/edit a vhost entry, and then restart the web server.
David
If you're running Windows, you may want to give Wampserver a shot. Through tray icon, you can reach several tools, like Apacha aliases and service management with a few clicks. It easies my life for sure!
pestaa
A: 

Dynamically Configured Mass Virtual Hosting from Apache 2.x documentation may be an answer to your question.

I agree that development configuration should be as close as possible to production environment.

squadette
localhost:{numeric port number} is still a whole hell of a lot faster then any form of vhosting unless you have some sort of internal LAN dns to provide *.dev.local names. I could be wrong but I don't think you can automatically tell Apache2's dynamic vhost module to host in incremental port numbers.
David
Perhaps not, but you can add more local IP's to your PC and use the IP-based option (http://httpd.apache.org/docs/2.0/vhosts/mass.html#ipbased). Also, I haven't tested, but it might be possible that (if you used port) that it would be appended to the IP-based naming somehow.
Kevin Peno
@David - no need for real DNS -- check your /etc/hosts file
timdev
+1  A: 

Have you looked at nanoweb? It looks like it might fit your requirements:

  1. Written in php, so once its up and running, serving pages should be pretty fast
  2. Can be installed and run from a user's home directory

Note: I haven't tried it myself, I'm pretty happy using apache, but I thought I'd pass the info along

Chris Gow
I've never even heard of it actually, going to check it out tonight.
David
A: 

http://code.google.com/p/phpmvchelpers/wiki/script%5Fserve

This is what I was looking to accomplish, the hack I made up isn't perfect but its functional. Needs a couple more hours work to get the re-write rules dialed in and some more brush up work but its functional for Kohana & CakePHP... still working on Recess framework though.

David