How to Addon Domain in Linux Server(CentOS)?

Step1. Login to the server with SSH access and then install Apache service.

[root@zcom-mm ~] # yum install httpd -y

Step2. Start httpd service.

[root@zcom-mm ~] #systemctl enable httpd

[root@zcom-mm ~] #systemctl start httpd

[root@zcom-mm ~] #systemctl status httpd

Step3. Find DocumentRoot Directory

[root@zcom-mm ~] # grep -i 'DocumentRoot' /etc/httpd/conf/httpd.conf

Step4. Add Domain under DocumentRoot Directory (“/var/www/html”).

[root@zcom-mm ~] # cd /var/www/html/

[root@zcom-mm ~] # mkdir

[root@zcom-mm ~] # ls

Step5. Add the testing “web file” in Domain folder.

[root@zcom-mm ~] # vim index.html

Add the following sample code.

<h1> Hello, this is Domain</h1>

And “ Save and Quit”.

View “web file”.

Step6. To edit “” in “/etc/httpd/conf.d”

[root@zcom-mm ~] # cd /etc/httpd/conf.d

[root@zcom-mm ~] # vim

Please paste the following code in “”.

<VirtualHost *:80>
DocumentRoot "/var/www/html/"
<Directory "/var/www/html/">
Options FollowSymLinks
AllowOverride All
Options -Indexes

“Save” and “Quit”

 View “” file

[root@zcom-mm ~] # ls

Step7. Restart “httpd”

[root@zcom-mm ~] #systemctl restart httpd

Step8. Open port number (80) in firewall

[root@zcom-mm ~] #firewall-cmd --zone=public --add-port=80/tcp –permanent

[root@zcom-mm ~] #firewall-cmd –reload

Thank you!!!

18Cloud VPS
Back To Top