Day 7 β notes
Today we have seen step by step instructions to install apache2 webserver on our linux machines.
- apache2
- nginx
- IIS
- httpd
These are some common webserver applications being widely used around the world. In this sessio, we have seen how to install apache2 on debian based OS machine.
apache2 is a webserver daemon application(kind of background processes that start at system boot and continue running until the system is shut down)
sudo apt install apache2 -y
Above command install apache2 on our machine. The argument -y is added in the same command to pass it when the terminal prompts for an answer.
After installation, if incase the system is restarted, by default the apache2 service would be in βdisabledβ state. So, in order to keep it active always at any time although if restart occurs, we need to use below command.
sudo systemctl enable apache2
sudo systemctl status apache2
This command is used to check if apache2 webserverβs status or to check if it is installed.
To check in which port the apache2 webserver is running, use command as below
It shows the application is running in port 80
By default β post apache2 installation, if we try βlocalhostβ in browser, it will display index page of apache2 that is present in /var/www/index.html
We have seen how to edit that html through vim and how to keep custom html page.
Post editing html β when we invoke βlocalhostβ the updated html page is visible in browser. Moreover, the same html content can be seen in the terminal through below command
We have also seen how to install such application in WAN. Dhanasekar showed how to procure a cloud machine from linode akamai website. I will try the same after some time.
We have see how to transfer a file from localmachine to remote machine using scp command. As per below screenshot β the index.html file from local machine has been transferred to remote machine to display the home page when apache2 server runs in remote machine.
Below commands can be used to start/stop the webserver
systemctl start apache2 systemctl stop apache2 systemctl restart apache2