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 myanmarlab.online
[root@zcom-mm ~] # ls
Step5. Add the testing “web file” in Domain folder.
[root@zcom-mm ~] # vim index.html
Add the following sample code.
<html> <h1> Hello, this is myanmarlab.online Domain</h1> </html>
And “ Save and Quit”.
View “web file”.
Step6. To edit “myanmarlab.online.conf” in “/etc/httpd/conf.d”
[root@zcom-mm ~] # cd /etc/httpd/conf.d
[root@zcom-mm ~] # vim myanmarlab.online.conf
Please paste the following code in “myanmarlab.online.conf”.
<VirtualHost *:80> DocumentRoot "/var/www/html/myanmarlab.online" ServerName www.example.com ServerAlias example.com <Directory "/var/www/html/myanmarlab.online"> Options FollowSymLinks AllowOverride All Options -Indexes </Directory> </VirtualHost>
“Save” and “Quit”
View “myanmarlab.online.conf” 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!!!