You can configure Apache server in Linux by following these steps:
Install Apache web server by running the following command:
sudo apt-get update sudo apt-get install apache2
Once the installation is complete, start the Apache service by running:
sudo systemctl start apache2
Check the status of the Apache service by running:
sudo systemctl status apache2
This should show that Apache is active and running.
Configure firewall to allow HTTP and HTTPS traffic by running the following commands:
sudo ufw allow http sudo ufw allow https
Test if Apache is working by opening a web browser and entering your server’s IP address or hostname. You should see the Apache2 Ubuntu Default Page.
(Optional) If you want to configure a custom virtual host, you can create a configuration file for it in the /etc/apache2/sites-available/ directory, such as example.com.conf. In this file, you can configure the virtual host’s document root, server name, and other settings. For example:
ServerName example.com DocumentRoot /var/www/example.com AllowOverride All Require all granted
Then, enable the virtual host by running:
sudo a2ensite example.com
Reload Apache by running:
sudo systemctl reload apache2
And finally, create the document root directory for the virtual host and add your website files to it.
That’s it! You have now configured Apache web server in Linux.
how to install apache on ubuntu?
You can install Apache web server on Ubuntu by following these steps:
Open a terminal window.
Update the package list by running the following command:
sudo apt-get update
Install Apache by running the following command:
sudo apt-get install apache2
Once the installation is complete, start the Apache service by running:
sudo systemctl start apache2
Check the status of the Apache service by running:
sudo systemctl status apache2
This should show that Apache is active and running.
(Optional) If you want to verify that Apache is working correctly, open a web browser and enter your server’s IP address or hostname. You should see the Apache2 Ubuntu Default Page.
That’s it! Apache web server should now be installed and running on your Ubuntu system.