
{{ $('Map tags to IDs').item.json.title }}
How to Install Apache Web Server
The Apache Web Server, also known as Apache HTTP Server, is one of the most widely used web servers worldwide, known for its robust features and flexibility. This tutorial will guide you through the installation of the Apache Web Server on various Linux distributions.
1. Installing Apache
To install Apache, use your distribution’s package manager. Here are the commands for popular Linux distributions:
- For Ubuntu:
sudo apt update sudo apt install apache2
- For CentOS:
sudo yum install httpd
- For Fedora:
sudo dnf install httpd
2. Starting Apache Service
After installation, start the Apache service:
sudo systemctl start apache2
On CentOS or RHEL, the command would be:
sudo systemctl start httpd
2.1. Enabling Apache on Boot
To ensure that the Apache service starts automatically at boot, run:
sudo systemctl enable apache2
For CentOS/RHEL:
sudo systemctl enable httpd
3. Configuring the Firewall
Ensure that your firewall allows HTTP traffic. For example:
- For UFW:
sudo ufw allow 'Apache'
- For firewalld:
sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --reload
4. Testing the Installation
To test if Apache is running correctly, open a web browser and enter your server’s IP address or localhost
if you are testing locally:
http://localhost
You should see the default Apache welcome page, confirming successful installation.
5. Configuring Apache
The main configuration file for Apache is located at:
/etc/apache2/apache2.conf (for Ubuntu)
/etc/httpd/conf/httpd.conf (for CentOS)
You can edit this file as needed to change settings, such as the document root or enable modules.
6. Restarting Apache
If you make changes to the configuration file, don’t forget to restart the service for the changes to take effect:
sudo systemctl restart apache2
For CentOS:
sudo systemctl restart httpd
7. Conclusion
By following this tutorial, you have successfully installed and configured the Apache Web Server on your Linux system. Apache is a flexible and powerful server that forms the backbone of many websites. Continue to explore its configuration options and modules to enhance your web server experience!