CentOS 7/8 Install Apache server yum install httpd systemctl start httpd systemctl status httpd systemctl restart httpd Configure Apache server The next step is to add and update the VirtualHost for a new domain in Apache. Each domain needs its own configuration file. The configuration files use the .conf extension, and need to be saved in the /etc/httpd/ conf.d / directory. Create a file at /etc/httpd/ conf.d / yourdomain.com.conf and add the following lines to it. # vi /etc/httpd/conf/ httpd.conf < virtualhost *:80=""> ServerAdmin
[email protected] ServerName yourdomain.com DocumentRoot /var/www/html/ yourdomain.com / ErrorLog /var/log/httpd/ yourdomain.com / error.log CustomLog /var/log/httpd/ yourdomain.com / access.log combined </ virtualhost > Create a directory for the website and then create index.html file for the website. # mkdir /var/www/html/ yourdomain.com Now add some content to index.html . # vi /var/www/html/ yourdomain.com / index.html service httpd restart Open any browser and enter the website URL. http:// yourdomain.com