Apache httpd : Virtual Hostings2024/11/08 |
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 [/var/www/virtual.host]. |
[root@www ~]#
vi /etc/httpd/conf.d/vhost.conf # create new # settings for original domain
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName www.srv.world
</VirtualHost>
# settings for new domain
<VirtualHost *:80>
DocumentRoot /var/www/virtual.host
ServerName www.virtual.host
ServerAdmin webmaster@virtual.host
ErrorLog logs/virtual.host-error_log
CustomLog logs/virtual.host-access_log combined
</VirtualHost>
<Directory "/var/www/virtual.host">
Options FollowSymLinks
AllowOverride All
</Directory>
mkdir /var/www/virtual.host [root@www ~]# systemctl reload httpd |
[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 /var/www/virtual.host/index.html <html> <body> <h1 style="width: 100%; font-size: 40px; text-align: center;"> Virtual Host Test Page </h1> </body> </html> |
Sponsored Link |
|