As usual there are loads of different ways, but what I do is,
1. Install the Apache module to allow Apache to run as my user.
$ sudo apt-get install apache2-mpm-itk
2. Create a virtual host, by creating a file in /etc/apache2/sites-available/mysite with the contents,
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mysite
DocumentRoot /home/ian/Projects/mysite
<Directory /home/ian/Projects/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<IfModule mpm_itk_module>
AssignUserId ian ian
</IfModule>
ErrorLog /var/log/apache2/mysite-error.log
CustomLog /var/log/apache2/mysite-access.log combined
</VirtualHost>
Adjust your paths and userid as appropriate.
3. Edit /etc/hosts to append mysite to localhost
127.0.0.1 localhost mysite
4. Create the ‘Projects’ directory above, e.g. /home/ian/Projects/mysite and dump a 1 line index.html file there with hello world
5. Enable site and restart Apache
$ sudo a2ensite mysite
$ sudo /etc/init.d/apache2 restart
6. Browse to https://mysite and see ‘hello world’
Now that’s working you can follow the 5 minute WordPress install to create an installation in mysite. For example,
$ rm -rf /home/ian/Projects/mysite
$ cd /home/ian/Projects/
$ unzip wordpress-x.x.x.zip
$ mv wordpress mysite
$ mysql -uroot -psecretpass
mysql> create database mysite;
Browse to https://mysite and follow the instructions. Automatic updates and plugin installs all work without prompting for FTP information because all the files in Projects are owned by you and Apache is running as the same user.
Rinse, repeat for more sites.
I’ve got about 20 virtual hosts with WordPress, Drupal etc. installed in each Projects directory, for theme, plugin development
Ian.