Apache2 : Virtual Hostings2021/09/07 |
Configure Virtual Hostings to use maltiple domain names.
|
|
[1] | For example, Add a new Host setting that domain name is [virtual.host], document root is [/var/www/virtual.host]. |
root@www:~#
vi /etc/apache2/sites-available/virtual.host.conf # create new
# settings for new domain
<VirtualHost *:80>
DocumentRoot /var/www/virtual.host
ServerName www.virtual.host
ServerAdmin webmaster@virtual.host
ErrorLog /var/log/apache2/virtual.host.error.log
CustomLog /var/log/apache2/virtual.host.access.log combined
</VirtualHost>
<Directory "/var/www/virtual.host">
Options FollowSymLinks
AllowOverride All
</Directory>
a2ensite virtual.host Enabling site virtual.host. To activate the new configuration, you need to run: systemctl reload apache2root@www:~# systemctl restart apache2 |
[2] | Create a test page and access to it from any client computer with web browser. It's OK if following page is shown. |
<html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Virtual Host Test Page </div> </body> </html> |
Sponsored Link |