I plan to develop multiple websites using Joomla. I'm using Ubuntu Desktop, and only need to access the sites and configuration files locally, while logged in to my user account.
Previously I tried this using tasksel
and set up a LAMP server with files in /var/www
, but then encountered problems with developing more than one site, and also permissions issues when editing code like CSS files.
How do I set up multiple Joomla sites, each in its own directory and database, for developing on a local desktop machine? Do I even need directories outside of /home
?
Related questions here (simplest way to add & edit files in /var/www) and here (avoid sudo when working in /var/www). This might even be a duplicate of one of those, unless there is a simpler solution for web developers.
I would use Name-based Virtual Hosts support in Apache.
First, you need to modify your
/etc/hosts
file to add some names which resolve to your local loopback interface:Then, in your home directory, you create a directory for your sites, say,
sites
and a sub-directory for each one:Each
apache_config
file would define configuration for each of your virtual hosts:Then you symlink all the configs into
/etc/apache2/sites-enabled
Restart Apache.
And that technically should be it - all your sites and their configs are in your home directory, editable by you.
I haven't tested the steps, so it's just a general outline, but that's where I would start. I would avoid placing my work files into
/var/www
(or using Apache's default virtual host in general), and also I would avoid modifying Apache's main config file (/etc/apache2/apache2.conf
) or the default virtual host file (the one in/etc/apache2/sites-enabled/000-default
).