Virtual host in apache
1. Go to /etc/apache2/site-enable location.
2. Create file school.loc.conf and save the code which is below
<VirtualHost *:80>
ServerName school.loc
ServerAlias www.school.loc
ServerAdmin webmaster@localhost
DocumentRoot /var/www/school.loc
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
3. run the command to enable virtual host
$sudo a2ensite school.loc.conf
4. Next, disable the default site defined in 000-default.conf:
$sudo a2dissite 000-default.conf
5. Now restart the apache server
sudo systemctl restart apache2
No comments:
Post a Comment