How to Install Apache web server on ubuntu 20.04 LTS
The Apache Web Server, called Apache is a open-source cross-platform web server software package that turns a computer into an HTTP server. Apache open-source software, its means it can be used and modified freely. Apache is developed and maintained by an open community of developers Apache Software Foundation.
Install Update on Ubuntu
Before installing new software, it’s a good to update ubuntu operating system database to make sure you are accessing the latest versions. use below mention command for update ubuntu server.
$ sudo apt-get update
Installation of the Apache package on Ubuntu, use the command:
$ sudo apt-get install apache2
Replace Localhost with the IP address of your server. If you are don't know what's the IP address, run the following terminal command:
$ hostname -I | awk '{print $1}'
By default apache working on 80 port. so if local firewall active on your ubuntu server need to configure UFW firewall to allow traffic on port 80.
1. First check status of UFW firewall on ubuntu server using below mention command.
$ sudo ufw status
$ sudo ufw app list
$ sudo ufw allow 'Apache'
$ sudo ufw status
After allow the apache application in ufw firewall open browser and type http://10.0.0.147 (Your server ip address) and press enter.
How to Start, restart, stop, reload and check status of Apache Service.
If you do any changes in Apache in that case you need to start, restart, stop, reload and check status of Apache. if you need use the following command for start, restart, stop, reload and check status.
1. For check the status of apache.
$ sudo systemctl status apache2.service
2. For Stop the service of apache.
$ sudo systemctl stop apache2.service
3. For start the service of apache.
$ sudo systemctl start apache2.service
$ sudo systemctl restart apache2.service
$ sudo systemctl reload apache2.service
Apache Configuration Files and Directories
Directories
Apache by default creates a document root directory at /var/www/html.
Configuration Files
Website content is stored in the/var/www/html/directory.
Apache creates log files for any errors it generates in the file /var/log/apache2/error.log.
It also creates access logs for its interactions with clients in the file /var/log/apache2/access.log.
Its apache main configuration file /etc/apache2/apache2.conf.
Its apache port configuration file. You can customize the ports Apache port from here. by default its working on 80 /etc/apache2/ports.conf .
Apache virtual host Storage file /etc/apache2/sites-available.
This directory holds websites that are ready for client /etc/apache2/sites-enabled.
0 Comments