To install Apache on Ubuntu 24.04, follow these steps:
Update the package index:
sudo apt update
Install Apache:
sudo apt install apache2
Verify that Apache is installed and running:
sudo systemctl status apache2
This command will show the status of the Apache service. You should see a message indicating that the service is active (running).
Adjust the Firewall to Allow Web Traffic: If you have a firewall running, you need to open HTTP (port 80) and HTTPS (port 443) traffic. You can do this with the following commands:
sudo ufw allow in "Apache"
To verify the changes:
sudo ufw status
Test Apache: Open a web browser and navigate to your server's IP address or domain name (e.g.,
http://your_server_ip
). You should see the default Apache welcome page, which means the installation was successful.Basic Commands to Manage Apache:
Start Apache:
sudo systemctl start apache2
Stop Apache:
sudo systemctl stop apache2
Restart Apache:
sudo systemctl restart apache2
Reload Apache (useful if you made changes to the configuration files):
sudo systemctl reload apache2
Enable Apache to start on boot:
sudo systemctl enable apache2
Disable Apache from starting on boot:
sudo systemctl disable apache2
By following these steps, you'll have Apache installed and running on your Ubuntu 24.04 server.