Web Servers (Apache and IIS) –HTTP transactions – Apache, MySQL and
PHP installation -Microsoft IIS Express and WebMatrix
Web Servers (Apache and IIS) – Port 80 or 443
A web server is a system—either software, hardware, or both—that stores,
processes, and delivers web content to users over the Internet using the HTTP or
HTTPS protocol. When a user’s browser sends a request (like visiting a website),
the web server responds by delivering the appropriate resources, such as HTML
pages, images, videos, or data
How Does a Web Server Work?
When a user accesses a website by entering a URL in their web browser, the
browser sends an HTTP request to the web server hosting the website. The web
server processes this request and returns the necessary resources to display the
page on the user’s browser.
Work Flow
1. Client Request: In the web browser(https://www.example.com/) the user
enters a URL.
2. DNS Resolution: To get the IP address of the requested domain, the
browser contacts a Domain Name System (DNS) server.
3. Connecting to the Web Server: Using the obtained IP address the
browser establishes a connection with the web server.
4. Processing Request: The web server receives the request and
processes it.
5. Serving the Response: The requested
files(HTML, CSS, JavaScript, images ) are sent back to the client's browser
by the web server.
6. Rendering the Web Page: Based on the received data the browser
displays the web page to the user.
Apache Web Server
Apache Web Server is one of the most widely used and the oldest open-source
web servers available under the Apache License 2.0 which means that it can be
freely used and can be modified. It was developed by the Apache Software
Foundation, and first released in 1995. It is highly flexible and customizable. It is
written in the C programming language.
Apache HTTP Server (commonly called just Apache) is a free, open-source
web server software developed and maintained by the Apache Software
Foundation. It is one of the oldest and most widely used web servers in the
world.
Key Features of Apache
Open Source
Cross-platform
Supports many languages
Virtual Hosting
Security
Configuration Files
File Purpose
httpd.conf Main Apache configuration file
Per-folder configuration (optional, powerful
.htaccess
for URL rewriting, redirects)
IIS (Internet Information Services)
IIS is a web server developed by Microsoft for hosting websites and web
applications on Windows operating systems. It supports HTML, ASP.NET,
PHP, and other web technologies.
An IIS web server runs on the Microsoft .NET platform on the Windows OS. While
it’s possible to run IIS on Linux and Macs using Mono, it’s not recommended and
will likely be unstable.
Key Features of IIS
Developed by Microsoft
Only runs on Windows OS
Uses web.config (XML-based)
Supports ASP.NET, C#, VB.NET, PHP (via FastCGI), HTML, JS
Managed using IIS Manager (Graphical Interface)
Security - Integrated Windows Authentication
Virtual Hosting - Can host multiple websites
Working
1. Browser sends a request to a website hosted on IIS (e.g.,
http://localhost)
2. IIS receives the request and checks configuration.
3. If it’s a static file, it directly serves it.
4. If it’s dynamic content (e.g., ASP.NET), it passes it to the appropriate
handler.
5. The response is generated and sent back to the browser.
Installing IIS on Windows
Steps to Enable IIS:
1. Go to Control Panel → Programs → Turn Windows features on or off
2. Check Internet Information Services
3. Click OK and wait for it to install
Access IIS:
Open Run (Win + R) → Type inetmgr → Enter
You’ll see the IIS Manager GUI
Default Website Location
Folder Description
C:\inetpub\wwwroot Default folder for IIS websites
index.html or default.aspx Default homepage
HTTP Transaction
An HTTP transaction is a communication between a client (browser) and
a server. It involves:
A request from the client
A response from the server
It follows the HTTP (HyperText Transfer Protocol) standard, which governs
how web data is transmitted.
1. HTTP Request (From Client → Server)
Sent by the browser or app when you visit a webpage.
Ex:
GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0
Accept: text/html
2. HTTP Response (From Server → Client)
Status Line: HTTP version, status code (e.g., 200, 404), message
Headers: Metadata (content-type, content-length, etc.)
Body: Actual content (HTML, JSON, image, etc.)
Ex:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1024
<html>
<body>Hello, world!</body>
</html>
HTTP Methods
Method Description
Requests data from the server (e.g., load a
GET
webpage)
POST Sends data to the server (e.g., form submission)
PUT Updates existing data
DELETE Removes data
HEAD Like GET, but without the body
Status Codes (in HTTP Responses)
Code Meaning Description
200 OK Request was successful
404 Not Found Resource not found
Server encountered a
500 Server Error
problem
Resource moved to a new
301 Moved Permanently
URL
403 Forbidden Access denied
Apache, MySQL and PHP installation – through XAMPP
IIS Express
IIS Express is a lightweight, free, and portable version of Microsoft’s full Internet
Information Services (IIS) web server.
IIS Express is used to run and test ASP.NET, PHP, or HTML websites locally before
deploying to a full IIS server.
WebMatrix
WebMatrix is a free lightweight IDE by Microsoft (now retired) designed to
make it easy to create, edit, and deploy websites.
As of 2016, WebMatrix has been discontinued by Microsoft. The modern
alternative is Visual Studio Code + IIS Express