AlmaLinux 9
Sponsored Link

Apache httpd : Virtual Hostings2023/03/03

Configure Virtual Hostings to use maltiple domain names.
[1] For example, Add a new Host setting that domain name is [], document root is [/var/www/].
[root@www ~]#
vi /etc/httpd/conf.d/vhost.conf
# create new
# settings for original domain

<VirtualHost *:80>
    DocumentRoot /var/www/html

# settings for new domain
<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog logs/
    CustomLog logs/ combined

<Directory "/var/www/">
    Options FollowSymLinks
    AllowOverride All

[root@www ~]#
mkdir /var/www/

[root@www ~]#
chmod 755 /var/www/

[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/
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Virtual Host Test Page
Matched Content