In this tutorial I am going to explain to you how we can point a domain name to our website which was hosting in Apache server in simple steps.

Setup A Virtual Host in Apache server

Step 1. Hope you already installed Apache in your server. If not then please run below commands to do.

Step 2. Now create your project in /var/www/html/myproject.com. For now, I just create an index.html file in it and write hello.

Step 3. Now we can point a domain to our server I am using Cloudflare for that. In Cloudflare, you need to add a domain to your account then go to DNS setting and point the domain to your IP that’s it.

Step 4. Now go to /etc/apache2/sites-available and copy 000-default.conf and name that mydomain.com.conf

Step 5. Open copy file in the editor and make some required changes as shown below.

After the file was open make changes or just copy below code and replace mydomain.com with yours.

Step 6. Now once you make changes in your file then you need to enable your website to do that run below command

After that restart your Apache server

and once your server is restarted you can open your website in the browser and get “helo” page.

Hope this simple ost helps you 🙂 .