Dynamic LAMP setup for localhost development

If you are developing PHP application on your own PC, you probably have some vhost based configuration of your Apache. With some tricks, you can turn your Linux box into powerful development server without configuring vhost for every app . In the minimum configuration effort, you need to pass those steps:

  1. checkout repository to disk
  2. create vhost configuration with some ServerName
  3. create entry in /etc/hosts which reflects server name used in vhost to 127.0.0.1

I’m pretty sure, that above path is used by many developers. We can ommit two lasts steps, limiting preparation of the environment only to place source code somewhere in filesystem. To achieve this we need mod_vhost_alias module for Apache2 and simple DNS server which will resolve local domain names for us.

Read more