How To

Apache on Ubuntu 26.04 Installation Guide for Beginners

Setting up Apache Ubuntu 26.04 is one of the fastest ways to launch a reliable web server for hosting websites and applications. Apache remains one of the most widely used open-source web servers thanks to its flexibility, stability, and extensive module support.

Ubuntu 26.04 includes Apache packages in its default repositories, making the installation process simple even for beginners. In this guide, you’ll learn how to install Apache, allow web traffic through the firewall, and configure a virtual host for hosting multiple websites.

Why Use Apache Ubuntu 26.04?

Apache is trusted by developers, businesses, and Linux administrators worldwide. It supports dynamic modules, SSL integration, URL rewriting, and virtual hosting. Because Ubuntu 26.04 offers long-term support and updated packages, it provides a stable environment for running production websites.

Apache also works well with PHP, MySQL, and other popular web technologies, making it a solid choice for both personal and enterprise deployments.

Install Apache on Ubuntu 26.04

Before installing Apache, refresh your Ubuntu package index:

sudo apt update

Next, install the Apache web server package:

sudo apt install apache2

Once the installation finishes, Ubuntu automatically starts the Apache service. You can verify its status with:

sudo systemctl status apache2

If Apache is running correctly, the service status will show as active.

Configure Firewall for Apache

Ubuntu systems commonly use UFW as the firewall manager. To allow both HTTP and HTTPS traffic, enable the Apache Full profile:

sudo ufw allow 'Apache Full'

After applying the rule, check the firewall status:

sudo ufw status

This step ensures visitors can access your server through ports 80 and 443 without connectivity issues.

Verify Apache Installation

To confirm Apache is working properly, open a browser and enter your server IP address:

http://your_server_ip

You should see the default Apache welcome page. This confirms the web server is installed and accessible from the network.

You can also test locally using:

curl http://localhost

Create an Apache Virtual Host

Virtual hosts allow Apache to host multiple websites on the same server. Start by creating a website directory:

sudo mkdir -p /var/www/example.com

Then create a sample HTML file:

sudo nano /var/www/example.com/index.html

Next, create a virtual host configuration file inside /etc/apache2/sites-available/.

A standard configuration should include:

  • ServerName
  • DocumentRoot
  • Log file locations
  • Directory permissions

After saving the configuration, enable the site:

sudo a2ensite example.com.conf

Test the Apache configuration:

sudo apachectl configtest

Finally, restart Apache:

sudo systemctl restart apache2

Final Thoughts on Apache in Ubuntu 26.04

Deploying Apache Ubuntu 26.04 is straightforward and beginner-friendly. With only a few commands, you can install a fully functional web server, secure firewall access, and configure virtual hosts for multiple domains.

Whether you are hosting a personal project, running a development environment, or deploying a production website, Apache on Ubuntu 26.04 provides a dependable and scalable solution for modern web hosting.

Cyber Defence

Recent Posts

How to Configure Static IP on Ubuntu Settings Easily

Setting up a Static IP on Ubuntu configuration is essential for servers, remote access systems,…

15 hours ago

How to Change Ubuntu Timezone Using Terminal or GUI

Keeping the correct system clock is important for servers, desktop systems, scheduled tasks, and application…

18 hours ago

How to Perform Ubuntu Hostname Change Without Rebooting

An Ubuntu Hostname Change is a common administrative task used to rename Linux servers, desktops,…

21 hours ago

How to Add Ubuntu Swap Space for Better System Stability

Ubuntu Swap Space helps Linux systems stay responsive when physical RAM starts running low. Instead…

1 day ago

Install TeamViewer on Ubuntu 26.04: Complete Setup Guide

If you need secure remote desktop access on Linux, learning how to Install TeamViewer on…

2 days ago

Install VirtualBox Ubuntu 26.04 for Easy VM Setup

If you want to test operating systems, build development labs, or safely run isolated environments,…

2 days ago