The Webserver Apache gives you the Opportunity to setup virtual namebased Hosts for different Projects. If you are working on different projects in your localhost-section, virtual Hosts can help you to organize different projectdata-paths on one IP-Address. Because we also wanted to have the possibility to perhaps install different versions of moodle, we setup a virtual host for both moodle and mahara.
To configure a vHost in Apache2 on a Ubuntu 12.04 System, we only had to insert a new configuration file for each projectfolder inside the folder /etc/apache2/sites-available/ with the following content:
The file badgesproject_moodle.conf
Options -Indexes +FollowSymLinks -MultiViews -Includes
allow from all
CustomLog /var/log/apache2/access-badges.log combined
The file badgesproject_mahara.conf
Options +Indexes +FollowSymLinks +MultiViews +Includes
allow from all
CustomLog /var/log/apache2/access-badges-mahara.log combined
You also define the path to the errorlogs inside of this, so if you are running into problems you can look up these files.
To activate or disable the sites on Apache two administrator commands are available:
You can see the enabled sites in the folder: etc/apache2/sites-enabled/.
If you are using the SoftwarebundleXAMPP, the configuration files of Apache Server are divided in importable files and you have to uncomment the import of the file httpd-vhosts.conf inside of the main configuration file httpd.conf. You have to define the vHost Configuration content inside of the file httpd-vhosts.conf.
For making the virtual adresses available, you have to configure the hosts file (e.g Linux: /etc/hosts) of your operating system by adding these lines: