How to Install Apache Service and Addon Domain on CentOS Server?

Modified on Sun, 28 Sep at 5:12 PM

How to Install Apache Service and Addon Domain on CentOS Server?


Step1. Login to the Cloud Server with SSH access. Server IP- 123.45.67.89 (login with your cloud VPS server IP)

Step2. Firstly, we need to check install ready or not Apache service in our service. After that we will install latest version.


root@123-45-67-89 :~# systemctl status httpd


root@123-45-67-89 :~# yum update httpd


root@123-45-67-89 :~# yum install httpd

Step3.If we’ve finished the Apache installation, we need to check the service status.


root@123-45-67-89 :~# systemctl status httpd


 root@123-45-67-89 :~# systemctl start httpd

If we’ve finished the Apache installation, the firewall must be turned on to be able to use HTTP using the command. Then we can check the default webpage from the URL.


root@123-45-67-89 :~# firewall-cmd –permanent –add-service=http


root@123-45-67-89 :~# firewall-cmd –reload


root@123-45-67-89 :~# systemctl start httpd


You can check with Server_IP (or) localhost.

Step4. If we want to connect with our own domain, we need to add the domain to the Apache webserver.


root@123-45-67-89 :~# mkdir /var/www/html/yourdomain_name/


root@123-45-67-89 :~# vim /var/www/html/yourdomain_name/index.html

<html>
    <body>
        Welcome to Myanmar Lab.
    </body>
</html>


Step5. Now we can check with our domain name.

Step6. If we’ve finished the domain addon process in the server, we need to adjust the config file in the Apache server.


root@123-45-67-89 :~# vim /etc/httpd/conf.d/ myanmarlab.online.conf

<VirtualHost *:80>
ServerAdmin admin@myanmarlab.online
ServerName myanmarlab.online
ServerAlias www.myanmarlab.online
DocumentRoot /var/www/html/myanmarlab.online/
</VirtualHost>

Step7. Now we can access the website with the domain name.


THANK YOU!!!

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article