Unit 2
Unit 2
PART 1
In today’s world, the internet has become a necessity for almost every
aspect of our lives. The Internet is used for communication, entertainment,
education, and even business. Behind every website we visit, there is a
web server that delivers the website’s content to our devices. This article
discusses what is web server, its functions, what is web server architecture,
its types, working, and what is web server security.
So, what is web server made up of? On the hardware side, a web server
connects to the internet, allowing it to share data or files with other devices
that are also connected. This data can take many different forms, like
HTML files, images, JavaScript files, and CSS stylesheets. Web server
hardware contains web server software as well.
Web server software governs how web users access hosted files. It is
made up of several parts, one of which is an HTTP server. An HTTP server
is a piece of software that understands HTTP queries and URLs.
The functions of a web server can be broken down into several categories:
The two main approaches to web server architecture are the concurrent
approach and the single-process-event-driven approach.
1. Concurrent Approach:
In the concurrent approach, the web server creates a separate process or
thread for each client request. Each process or thread handles one request
at a time, allowing multiple requests to be processed simultaneously.
2. Single-Process-Event-Driven Approach:
In the single-process-event-driven approach, the web server uses a single
process or thread to handle all client requests. The server waits for events
(e.g., new connection requests, and incoming data) and handles them one
at a time in a non-blocking manner.
3. Nginx:
Nginx is a high-performance, open-source web server software that is
known for its speed, scalability, and ease of use. It is often used as a
reverse proxy server or load balancer and can be used to serve static and
dynamic content.
4. Lighttpd:
Lighttpd is a lightweight, open-source web server software that is designed
for high performance and low resource consumption. It is known for its
speed, stability, and security features.
1. The client device (e.g., a web browser) sends a request to the web server
for a particular resource, such as a web page.
2. The web server receives the request and processes it, checking if the
requested resource exists and is accessible.
3. If the resource is available, the web server retrieves it and sends it back to
the client’s device as a response.
4. The client device receives the response and displays the resource (e.g.,
web page) to the user.
Static and dynamic web servers are two types of web servers that differ in
how they deliver web content.
Static web servers serve pre-existing web pages that do not change in real-
time. These web pages are usually written in HTML and CSS and are
stored on the web server’s file system. Whenever a client device requests a
page, the web server retrieves the requested file and sends it back to the
client as a response.
Dynamic web servers, on the other hand, generate web pages on the fly in
response to user requests. These servers use programming languages like
PHP, Python, and Ruby to build web pages from databases, APIs, and
other sources of dynamic data. Whenever a client device requests a page,
the server runs the necessary code to generate the page and sends it back
to the client as a response.
Uses of Web Server
Web servers have a wide range of uses and applications, as they are the
backbone of the internet and the means by which web resources are
delivered to users. Here are some of the most common uses of web
servers:
1. Hosting websites: Web servers are used to host websites, making them
accessible to users around the world. They serve up HTML, CSS,
JavaScript, and other web resources that make up web pages.
2. Running web applications: Web servers are used to host web
applications that run in the browser, such as online shopping carts, social
media platforms, and productivity tools.
3. Streaming media: Web servers are used to stream audio and video
content over the internet, allowing users to access music, movies, and
other multimedia resources.
4. Managing online databases: Web servers are used to manage online
databases, allowing users to access and manipulate data via web-based
interfaces.
5. Cloud computing: Web servers are used to power cloud computing
services, allowing users to access computing resources and data storage
via the Internet.
6. Internet of Things (IoT): Web servers are used to power IoT devices,
allowing them to communicate and exchange data over the Internet.
7. File sharing: Web servers are used to share files over the internet,
allowing users to access and download files such as documents, images,
and videos.
What is Web Server Security?
Web server security refers to the measures and practices used to protect a
web server from unauthorized access, malicious attacks, and other security
threats. A secure web server ensures that sensitive data and resources are
protected from unauthorized access, ensuring the confidentiality, integrity,
and availability of web resources.
1. Regular software updates: It’s important to keep the web server software
and applications up-to-date to address any security vulnerabilities or bugs.
2. Secure configuration: The web server should be configured with strong
security settings, such as secure file permissions, SSL/TLS encryption, and
secure authentication mechanisms.
3. Access control: The web server should be configured to restrict access to
sensitive data and resources, including password-protecting directories and
using firewall rules.
So, it is an interface for running executables via a web server. In general, it means
taking an HTTP request and passing it to an application in order to deliver a
dynamically generated HTML page back to a browser. However, any program that can
run on a web server is usable as a CGI script. Generally, CGI programs are used to
generate pages dynamically or to perform some other action when someone fills out
an HTML form and clicks the submit button. CGI applications can be written in any
programming language, some of which are Perl, PHP, and Python.
How CGI works?
The browser sends a URL that causes the AOL server to use CGI to run a program. The
browser runs on a client machine and exchanges information with a Web server using
the HyperText Transfer Protocol or HTTP. Depending on the type of request from the
browser, the web server may provide a document from its own document directory or
executes a CGI program which means it passes the input from the reader (browser) to
the program and output from the program back to the reader (browser). Thus, CGI
works as a gateway between the AOL server and the program you write.
The steps involved in creating a dynamic HTML document on the fly through CGI
are as follows:
Qualities of CGI
The following list includes some of the advantages of CGI:
Benefits of CGI:
o Currently, CGI is easier to use than Java for performing complex operations.
o Using pre-written code is usually simpler than writing your own.
o As long as they adhere to the definition, CGI allows programmes to be created in any
language and on any platform.
o There are many CGI-based counters and CGI programmes that can carry out basic
functions.
API
API stands for Application Programming Interface. API is actually some kind
of interface which is having a set of functions. These set of functions will
allow programmers to acquire some specific features or the data of an
application.
Web API is an API as the name suggests, it can be accessed over the web
using the HTTP protocol. It is a framework that helps you to create and
develop HTTP based RESTFUL services. The web API can be developed by
using different technologies such as java, ASP.NET, etc. Web API is used in
either a web server or a web browser. Basically Web API is a web
development concept. It is limited to Web Application’s client-side and also it
does not include a web server or web browser details. If an application is to
be used on a distributed system and to provide services on different devices
like laptops, mobiles, etc then web API services are used. Web API is the
enhanced form of the web application.
ASP.NET Web API: ASP.NET stands for Active Server Pages.NET. It is
mostly used for creating web pages and web technologies. It is considered a
very important tool for developers to build dynamic web pages using
languages like C# and Visual Basic. ASP.NET Web API is a framework that
helps you to build services by making it easy to reach a wide range of clients
including browsers, mobiles, tablets, etc. With the help of ASP.NET, you can
use the same framework and same patterns for creating web pages and
services both.
Where to use Web API?
HTML
CSS is an abbreviation for Cascading Style Sheets. It provides a technique for creating
graphic elements that help a web application's appearance look more appealing. A
style tag in a web page defines all the specifics regarding the web page's presentation,
including its border styles, image styles, colour, font styles, borders, format, font size,
margins, padding, etc.
JavaScript
VBScript
1. It is intended to execute code on which a web browser runs, and the results of the
inputs are delivered to an accessible user.
2. Client-side scripting enables greater involvement with clients via the browser and is
used to validate programs and functionality based on the request.
3. The client does not include any contact with the server in client-side scripting; the only
interaction is receiving the requested data
The server-side is made up of three parts: the database, the server, the APIs, and the
backend web software written in the server-side scripting language. When a browser
requests a page with server-side scripting, the web server evaluates the script before
delivering the page to the browser. In this case, script processing may entail collecting
information from a database, performing simple computations, or selecting the
relevant material to be shown on the client end. The output is provided to the web
browser when the script is processed. The web server hides the scripts from the end
user until the content is delivered, making the data and source code safer.
Python
It is an open-source language that is very powerful and easy to learn. It is suitable for
beginners because it is simple to learn and read. It is believed to be used by Google
and YouTube. It is a OOPs language with dynamic typing and data structures. It has
grown to be one of the most popular languages for both quick application
development and web development.
PHP
Ruby
It is a free and open-source programming language that was developed and firstly
introduced in the early 1990s. It is a dynamic language that is simple to read and write
and an OOPs language that is interpreted as it runs. It has evolved continuously since
its development and is one of the most utilized web development languages.