VOOZH about

URL: https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04

⇱ How To Install the Apache Web Server on Ubuntu | DigitalOcean


How To Install the Apache Web Server on Ubuntu

Updated on December 9, 2025
Not using Ubuntu 20.04?
Choose a different version or distribution.
Ubuntu 20.04
πŸ‘ How To Install the Apache Web Server on Ubuntu

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

πŸ‘ Erin Glass
Erin Glass
Author
Senior Manager, DevEd
See author profile

Open source advocate and lover of education, culture, and community.

πŸ‘ Manikandan Kurup
Manikandan Kurup
Editor
Senior Technical Content Engineer I
See author profile

With over 6 years of experience in tech publishing, Mani has edited and published more than 75 books covering a wide range of data science topics. Known for his strong attention to detail and technical knowledge, Mani specializes in creating clear, concise, and easy-to-understand content tailored for developers.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Thank you very much for your easy instructions on installing Apache2 server. it still proves that it takes a woman to get things right. I just switched over from centos 7 to the ubuntu 20.04 server due to vestacp problems and no kind of support for why my add on domains would not work but yet the main admin one would. still baffels me, but i’m a glutten for punishment so thought i would try it out on ubuntu 20.04. any way thanks for the excellent info and help the enternet needs more like you.

Hello!

Thanks for sharing this information. Here is a question

I have a website(example.com) already running in /var/www/html can i add another website (newdomain.com) by creating directory /var/www/newdomain.com and use it. Without changing the location of example.com as you know it will take time to transfer from /var/www/html to /var/www/example.com

Yes, i’m using Apache Web Server on Ubuntu 20.04 (LTS) x64

Please reply me ASAP

Now it’s easy, you can use easy-apache to set up everything for you, all you have to do is copy-paste below lines into your terminal, and enter your domain name when asked, it will also install SSL if you want

sudo add-apt-repository ppa:realpvn/easy-apache
sudo apt-get update
sudo apt-get install easy-apache

#to install Apache server
easy-apache -a

#to install SSL
easy-apache -s

#full setup, Apache and SSL
easy-apache -f

A very nice piece of Information. Nicely written. Thanks a lot. I was wondering for basic apache server setup. I will remember your name as my teacher. GBY.

how do I make my site visible to any other computer?

Issue: Error AH00558: Could not reliably determine the server’s fully qualified domain name

Solution: Add a line containing ServerName 127.0.0.1 to the end of the file:

sudo nano /etc/apache2/apache2.conf

Restart apache2

sudo systemctl restart apache2

=========================================================

Issue: can access the website via IP but not Domain Solution:

sudo nano /etc/hosts

add this code:

127.0.0.1 www.YOURDOMAIN.com

Restart apache2

sudo systemctl restart apache2

Worked great Thank you for the walkthrough!!!

Do we need to add /public_html to the directory if we want to add more than one virtual host site? If I add one using the above method it works fine but if I add a second one the second one won’t show up.

Thanks Erin!

Just a comment, that could help people. When following your tutorial after doing the configtest of apache I found ERROR AH00558. Since I was starting from scratch from a Desktop 20.04 Ubuntu distribution, I assume that it will happen to anybody doing the same thing.

The fix is easy, just add to your tutorial that if they find this error all they need to do is to add this line to their /etc/apache2/apache2.conf file using sudo nano /etc/apache2/apache2.conf, going to the end of the file and adding it, then <Ctrl>S, followed by <Ctrl>X

vim: syntax=apache ts=4 sw=4 sts=4 sr noet

ServerName 127.0.0.1

This is one of the best-written tutorials I’ve ever followed. Thanks, Erin!

πŸ‘ Creative Commons
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • Deploy on DigitalOcean

    Click below to sign up for DigitalOcean's virtual machines, Databases, and AIML products.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and AI-native businesses

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow β€” whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

Β© 2026 DigitalOcean, LLC.Sitemap.
Dark mode is coming soon.