How to setup virtual host

Virtual host is a function where you can host multiple website using 1 apache server

below are virtual host example.

Server > vi /etc/httpd/conf.d/your virtual name

<VirtualHost *:80>
ServerName www.host2.com
Server Alias
DocumentRoot /your directory
</VirtualHost>

<Directory /your directory>
Require all granted
</Directory>

you need to restart your apache to apply it.

Server > systemctl start httpd.services

Allow to go through firewall

Server > sudo firewall-cmd --permanent --add-service=http
Server > sudo firewall-cmd --reload

Comments