Web server is a very common issue we need to handle or implement for the client. Over 40 percent of market is using apache as web server for the client. We find several features which are useful for clients. It is most featured server in the industry. The support of this server is very popular among the administrators. Another reason to implement this server is that it is easy to install and configure.
There are few features of apache web server mentioned in below:
- Apache web server works using modules.
- The components or modules are independent.
- Each component can be configured separately.
- We can implement security using different modules.
- We can integrate system modules with apache web server.
- We can define each domain as virtual host using apache web server.
Before start installing and configuring the web server we need to configure the server properly first. Check the internet connection, yum configuration and server name. it is the best practice to put a fully qualified domain name for the server. Once all those are done we can finally begin the installation process.
To install the apache server we need to follow as below. First of all let’s update the server.
# yum update –y
The process will show a list of packages and at the end of the process we will see a message like “complete”. Once this is complete then we can start by installing the apache server.
For centos or red hat distribution the package name for apache server is HTTPD. So we have to run the below command for installing the apache server.
#yum install httpd –y
This will automatically find the dependences and other necessary packages for installing the apache server. Once this server is installed then we have to enable the server and start the server. For that we need to run the below command.
#systemctl enable httpd.service
#systemctl start httd.service
Now open the browser and write localhost on the server. We will see the building preview page.
Now initially we need to configure few issues in the httpd.conf file. The total path of this file is /etc/httpd/conf/httpd.conf.
We will read the file and find out the following lines.
Listen IP address:port number
Suppose the ip address is 192.168.1.3 and default port is 80. So it will be like
Another basic info we need to ensure is the document root file. This will look like
Once this all are done we have to restart the service and make sure these configurations become active. So we have to run the below command.
#systemctl reload httpd.service
#systemctl restart httpd.service
There is a big chance we will not get any response from the client machine. So we have to make sure that the clients are getting response from the client computer. For that we need to provide firewall rules or allow the ports and services from the server. For that we need to run the following command in the terminal.
#firewall-cmd – – add –service=http – – zone =public –permanent
#firewall-cmd – – add –service=https – – zone =public –permanent
#firewall-cmd – – add –port=80 – – zone =public –permanent
#firewall-cmd – – add –port=443 – – zone =public –permanent
Once all these rules are done we need to reload the firewalld.
For that we have to run the below command.
#firewall-cmd – reload
If we still do not get response from the client machine then we should disable the selinux and reboot the system.
This above full procedure is all about implementing apache web server. There is lots of work we still have which is necessary to do in a production web server. We will discuss about these issues in future articles.