You are currently viewing Add website to apache2 in 2021

Add website to apache2 in 2021

In this tutorial I will guide you step by step how to simply point domain address to your Ubuntu server and add website to apache2 which runs Ubuntu 20.04 distribution.

First of all to add website to apache2, make sure you own some kind of FTP and SSH services. If you are on Windows, I would personally recommend: When you connected to your server via FTP and via SSH. Make sure to update and upgrade all of your services by running:
  • sudo apt-get update && sudo apt-get upgrade
After successfully updating and upgrading your server, make sure to install Apache2 on your server by running:
  • sudo apt-get install apache2
Later after installing apache2, go straight to /etc/apache2/sites-available folder and create new file. For example you have a domain name yourdomain.com. Then create a file name yourdomain.com.conf. It is not mandatory to follow this pattern. In the other hand it makes easier to manage multiple websites. Then, in your yourdomain.com.conf file, write the following:
When you saved this file. Make sure go to /var/www and create directory with your domain name. And inside there, create index.html file. You can do that via SSH:
  • cd /var/www
  • mkdir yourdomain.com
  • cd yourdomain.com
  • touch index.html
Afterwards successfully creating a directory and index file, go back to your /etc/apache2/sites-available. And enable the certificate.
  • cd /etc/apache2/sites-available
  • sudo a2ensite yourdomain.com.conf
  • systemctl reload apache2
BAM! Now your website is LIVE! In conclusion, now you did add a website to your apache2 service, which is LIVE! If you have any questions, make sure to leave a comment or just contact us!

Leave a Reply