Apache httpd : Virtual Hostings2024/01/30 |
Configure Virtual Hostings to use multiple domain names. |
|
[1] | For example, Add a new Host setting that domain name is [virtual.host], document root is [/usr/local/www/apache24/virtual.host]. |
root@www:~ #
vi /usr/local/etc/apache24/Includes/vhost.conf # create new # settings for original domain
<VirtualHost *:80>
DocumentRoot /usr/local/www/apache24/data
ServerName www.srv.world
</VirtualHost>
# settings for new domain
<VirtualHost *:80>
DocumentRoot /usr/local/www/apache24/virtual.host
ServerName www.virtual.host
ServerAdmin webmaster@virtual.host
ErrorLog /var/log/virtual.host-error_log
CustomLog /var/log/virtual.host-access_log combined
</VirtualHost>
<Directory "/usr/local/www/apache24/virtual.host">
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
mkdir /usr/local/www/apache24/virtual.host root@www:~ # service apache24 reload |
[2] | Create a test page and access to it from any client computer with web browser. It's OK if following page is shown. |
root@www:~ #
vi /usr/local/www/apache24/virtual.host/index.html <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> Virtual Host Test Page </div> </body> </html> |
Sponsored Link |
|