Setting up multisite on Debian 8 using virtual hosts
Notes on how to set up multisite on Debian 8 by configuring virtual hosts.This post is about:
- Debian 8
- Apache 2
Configure the first website of your multisite installation (assuming that your website's files are located at /var/www/example.com/htdocs):
1. Create a config file for your first website:
sudo nano /etc/apache2/sites-available/example.com.conf
.conf part is important!
Alternatively you could copy default config file:
cp 000-default.conf example.com.conf
Add/modify the content of the file to be:
#
# Example.com (/etc/apache2/sites-available/example.com.conf)
#
<VirtualHost *:80>
ServerAdmin admin@example.com
ServerName example.com
ServerAlias www.example.com *.example.com
DocumentRoot /var/www/example.com/htdocs/
RewriteEngine On
RewriteOptions inherit
# Logfiles
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
</VirtualHost>
Save the file.
2. Activate the host:
sudo a2ensite example.com
3. Check the Apache config syntax to prevent it from crashing in case you made a mistake in configuration:
sudo apache2ctl configtest
4. If the status is OK, restart Apache:
sudo service apache2 restart
Create such a config file for every website in your multisite install.
*****
Other posts in the series:
- Installing LAMP stack on Debian 8.2
- Installing Drush on Debian server
- Drupal 8 website setup using Composer template