Setup
#Step 1: Make a Directory for Each Site ``` sudo mkdir -p /var/www/domain.com/public_html
```
#Step 2: Set Folder Permissions ``` sudo chmod -R 755 /var/www
```
if you are having problems with permissions just open it up and revoke access after (by running the first command above)
``` sudo chmod ugo+wrx -R /var/www
```
#Step 3: Set up an Index Page ``` sudo nano /var/www/domain.com/public_html/index.html #testing for domain.com ```
#Step 4: Copy the Config File for Each Site ``` cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/domain.com.conf ```
#Step 5: Edit the Config File for Each Site ``` sudo nano /etc/apache2/sites-available/domain.com.conf ``` ``` <VirtualHost *:80> ServerAdmin admin@example.com ServerName domain.com ServerAlias www.domain.com DocumentRoot /var/www/domain.com/public_html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> ```
#Step 6: Enable Your Config File
So, we will need to disable the default file. ``` a2dissite 000-default.conf ``` Enable new: ``` a2ensite domain.com.conf ```
restart service: ``` systemctl restart apache2 ``` #Step 7: Verify Apache Configurations