Deep dive Server!
The concept of “Server” is explained here in a detailed way, with a complete explanation of Apache Web Server!
If you ever thought to understand the difference between server and a normal computer is very difficult, then you have landed in the right place, because in this article I will explain each & every topic from complete scratch, & also my examples will be very relatable to the real world.
Explanation of Server
It is anything that provides a service. In very basic language (lamen language), then the server is considered as just a machine or any other thing which serves us.
For Example: You can consider me as a server, by the fact that right now you are interested in server & you want to gain knowledge about that, now, if you ask me that whether I can provide that knowledge about server, & the answer is yes, because you are reading this article & it is written by me. So, I can definitely be considered as a server.
In the Technical World, consider the server as just a program that serves according to which it is configured. It is a fact that a server can serve only the things for which it is configured. For example, consider the above example, I served the knowledge of server through this article, but somebody asks me to show the power of Iron Man, it is not possible, I will directly reject that request, & the same actions are performed by the server.
From the above discussion, it can be concluded that a server is just a program which serves us according to its ability or configuration of service.
Types of servers
- Web Server
- Mail Server
- Chat Server, etc.
There are many types of servers, which are used if & when they are required. For example, if we want to send a mail, then obviously we have to use the mail server which internally uses SMTP protocol. If we have to host a website, then we require a web server for that purpose.
For each type of server, there is a use case associated with it. Some of which are also explained above in the examples.
Ways to connect to a server!
In order to enjoy/avail a service, we have to first connect to the server, & it possible in 2 ways, which are listed below.
- The first way is to use a program that enables us to access the server screen on our machine. For example, “ssh” or “putty” software. Through these Softwares, we can easily access the screen of the server & avail the service, for example, by connecting to a machine that is configured as a web server, we can easily use ssh(secure shell) to connect to that machine & access the web pages.
Drawback of the 1st Approach: It requires password to & key to connect to the machine, & also generally a server is configured to serve for only 1 service, So, in that scenario we didn’t need to access the machine completely.
2. We can connect to a server by using a protocol, its IP address/DNS name, & or the file name. It is one of the most popular ways of connecting to a server.
For example, we use GMAIL, it is just a mail server, & we didn’t access it by ssh, we only use a protocol which is “https” or “http”, the DNS name GMAIL, & a client-side software to access the services of the webserver which is a Browser.
Bonus Tip1: Generally it is assumed that there is only a graphical browser like Safari, Google Chrome, Firefox, etc., but we also have a CLI browser, it doesn’t understand HTML language, but it can bring out the complete web page. Client browser is a command known as “CURL”, which stands for Client Uniform Resource Locator.
Bonus Tip2: One machine can be configured with multiple servers, like FTP service, WebServer, etc., they all can be configured in one machine.
When multiple servers are configured in a single machine, then in order to access a particular web server, we have to use “port number”. They are just a unique identifier for each server.
Basic Hierarchy of multiple servers can be understood in this way, Initially, there is an OS, on top of which we can run multiple servers (programs), each having their unique id (port number) through which each server can be accessed easily.
Steps to set up a server
The 3 step procedure given below has the capability to set up any server of the world.
- Install the server (program).
- Configure it.
- Execute it.
Apache Web Server Example Set up
Apache foundation has developed its own web server which is known by the name of “httpd”, it is also known as Apache Web Server.
It is a web server. It is easily available & can be used by anyone in the world for providing web services.
Almost every web server in this world has the default port number as 80.
Steps to configure it in the system:
- Download & install it in the system. For Redhat Linux, use the command “yum install httpd”, for ubuntu use command “apt-get install httpd”, for mac use command “brew install httpd” [if brew package manager is installed in MAC].
- Put your web pages in the default directory of httpd web server which is “/var/www/html”, any web pages present in this directory will only be used by httpd web server to provide the web services.
- Start the services of the server depending on your OS, the process may vary. But for Redhat Linux command is “systemctl start httpd”.
Bonus Tip 3: Default directory & Port number of httpd web server can be changed by changing the default values in the configuration files of httpd.
There is a Firewall present in each OS, which will block access to any of the services of the OS from the outside world. So, in order to use the above-explained web server, the firewall has to disable, or some rules should be added to that.
Command for disable firewall temporary in Redhat Linux “systemctl stop firewalld”, & for permanent disabling firewall, command is “systemctl disable firewalld”.
Difference between Program & Service
There is a very common myth in the market related to IT World, that is service & program are considered to one of the same thing. But they are completely different.
Program is any code which is saved in a file and stored on a disk, when it is loaded in the main memory, it becomes a process. This program will not provide any service to the outside world. In order to access a program, we have to login into the system.
For Example, Hello World Program.
Service is something, which is been provided to the outside world, & also we do not require to login to the system, in order to access those services.
For Example, a web server, without logging into the system, we use the service from the server.
Correct word for these services in the IT world is “Daemon”.
This is all about the server & each & every topic has been covered in absolute depth.
I hope my article explains each and everything related to Server along with the explanation & configuration of Apache Web Server. Thank you so much for investing your time in reading my article and boosting your knowledge!