6 Web And Email Services

Network and System Administration · Unit 6

Web and Email Services

Exam-focused notes for Web and Email Services (Network and System Administration, BIT451): what the TU syllabus asks and how it has actually been tested, with 7 solved past questions from this unit.

Web and Email Services in short

Web, proxy, mail and file transfer servers are the most common services an administrator runs. This chapter shows how each one is set up and how it works.

Web and Email Services: notes

Web server configuration process

A web server answers HTTP and HTTPS requests and sends pages to browsers. Apache is a popular open source web server. The usual process on Ubuntu is as follows.

  • Install the package.
  • Edit the configuration and set the server name, document root and logging.
  • Create the site files and set the correct permissions.
  • Test the syntax and start the service.
  • Open the firewall ports 80 and 443.
  • Test from a browser and read the logs.
sudo apt install apache2
sudo mkdir -p /var/www/example.com/public_html
echo "Hello" | sudo tee /var/www/example.com/public_html/index.html
sudo chown -R www-data:www-data /var/www/example.com
sudo apache2ctl configtest
sudo systemctl enable --now apache2
sudo tail -f /var/log/apache2/error.log

Main settings: Listen 80 sets the port, ServerName sets the host name, DocumentRoot sets the folder with the pages, and ErrorLog sets the log file. On Red Hat systems the package is httpd and the main file is /etc/httpd/conf/httpd.conf. On Windows Server, install IIS with Install-WindowsFeature Web-Server -IncludeManagementTools.

Name-based virtual hosting

Virtual hosting serves many websites from one server. In name-based hosting, all sites share one IP address. Apache reads the Host header of each request and picks the matching site.

<VirtualHost *:80>
    ServerName www.site1.com
    DocumentRoot /var/www/site1
</VirtualHost>

<VirtualHost *:80>
    ServerName www.site2.com
    ServerAlias site2.com
    DocumentRoot /var/www/site2
</VirtualHost>
sudo a2ensite site1.conf site2.conf
sudo apache2ctl -S
sudo systemctl reload apache2

The first virtual host is the default for names that match nothing. Both names in DNS must point to the same IP address.

What this unit covers

  • Web server configuration process
  • Name-based virtual hosting
  • IP-based virtual hosting and advantages
  • Proxy ACL configuration
  • Proxy caching server configuration and benefits
  • SMTP relay and operation
  • SMTP, POP3, and IMAP email protocols
  • FTP principles and anonymous FTP

Name-based virtual hosting

2082 · 10 marks

Differentiate between name based and IP based virtual hosting. Explain proxy ACL.[10]

Show solved answer

Model Answer: Virtual Hosting and Proxy ACL

Part 1: Name-Based vs IP-Based Virtual Hosting

Name-Based Virtual Hosting

Definition: Multiple websites (virtual hosts) are hosted on a single IP address, differentiated by their domain names (hostnames).

Key Characteristics:

  • Uses HTTP Host header to identify which website the client is requesting
  • Server examines the Host field in the HTTP request and routes to the appropriate virtual host
  • More efficient use of IP addresses
  • Requires DNS to resolve multiple domain names to the same IP address
  • Example: www.site1.com and www.site2.com both resolve to 192.168.1.10

Advantages:

  • Conserves IP addresses (critical when IPv4 addresses are limited)
  • Cost-effective hosting solution
  • Easier to manage multiple sites on one server

Limitations:

  • Requires HTTP/1.1 (older HTTP/1.0 clients may not send Host header)
  • Cannot be used for HTTPS without SNI (Server Name Indication)
  • Browser must support the Host header

IP-Based Virtual Hosting

Definition: Each virtual host is assigned a unique IP address on the same physical server.

Key Characteristics:

  • Each website has its own distinct IP address
  • Server uses the destination IP address to determine which virtual host to serve
  • Works at the network layer (Layer 3)
  • No dependency on HTTP headers
  • Example: www.site1.com → 192.168.1.10, www.site2.com → 192.168.1.11

Advantages:

  • Works with all HTTP versions (HTTP/1.0 and HTTP/1.1)
  • Compatible with HTTPS without SNI
  • No reliance on client-side Host header support
  • Better for legacy systems

Limitations:

  • Requires multiple IP addresses (expensive and wasteful)
  • More complex network configuration
  • Difficult to scale for large numbers of virtual hosts

Comparison Table

AspectName-BasedIP-Based
IP AddressesSingle IP for multiple sitesOne IP per site
DifferentiationDomain name (Host header)IP address
Resource UsageEfficientWasteful
HTTPS SupportRequires SNINative support
ScalabilityHighly scalableLimited
HTTP VersionHTTP/1.1 requiredAll versions

Part 2: Proxy ACL (Access Control List)

Definition

Proxy ACL is a set of rules configured on a proxy server (such as Squid) that controls and filters network traffic by allowing or denying access to specific resources based on defined criteria.

Purpose

  • Control which clients can access the proxy
  • Restrict access to specific websites or content
  • Implement bandwidth management
  • Enforce security policies
  • Block malicious or inappropriate content

Common ACL Criteria

  1. Source IP Address: Allow/deny based on client IP
  2. Destination IP/Domain: Allow/deny access to specific servers or websites
  3. Port Numbers: Control access to specific ports
  4. Time-based: Restrict access during certain hours
  5. Protocol: Allow/deny specific protocols (HTTP, HTTPS, FTP)
  6. URL Patterns: Block or allow based on URL matching
  7. User Authentication: Control based on username/credentials

Basic ACL Rule Structure

acl <name> <type> <value>
http_access allow/deny <acl_name>

Example (Squid Proxy)

acl internal_network src 192.168.1.0/24
acl blocked_sites dstdomain .facebook.com .youtube.com
acl work_hours time MTWHF 09:00-17:00

http_access allow internal_network work_hours
http_access deny blocked_sites
http_access deny all

Benefits

  • Enhanced security by filtering unwanted traffic
  • Bandwidth optimization
  • Content filtering and policy enforcement
  • Protection against unauthorized access
Open this answer on its own page →

Web server configuration process

2082 · 5 marks

Explain the process of web server configuration. [5]

Web server configuration is the process of setting up and customizing a web server to handle HTTP/HTTPS requests and serve web content according to specific requirements. Here is the systematic process: - Download and install the web server software (e.g., Apache, Nginx, IIS) - Ensure all depende...

Open this answer on its own page →

IP-based virtual hosting and advantages

2081 · 10 marks

Illustrate the concept of IP-based virtual hosting. How is it carried out? What are its advantages?[10]

IP-based virtual hosting is a technique that allows a single physical web server to host multiple websites, where each website is associated with a unique IP address. Each domain name is mapped to a different IP address on the same server, enabling the server to distinguish between different webs...

Open this answer on its own page →

SMTP relay and operation

2081 · 5 marks

What is SMTP relay and how does it work? [5]

SMTP relay is a mechanism that allows an email message to be forwarded from one mail server to another mail server on its way to the final destination. It enables mail servers to act as intermediaries in the email delivery process, passing messages between different mail systems until they reach ...

Open this answer on its own page →

FTP principles and anonymous FTP

2081 · 5 marks

Elaborate FTP principles. How does anonymous FTP work? [5]

File Transfer Protocol (FTP) is an application-layer protocol used for transferring files between computers over a network. The key principles are: - FTP operates on a client-server model where the client initiates connection to an FTP server - The server listens on port 21 (control connection) a...

Open this answer on its own page →

Proxy caching server configuration and benefits

2082.1 · 5 marks

What is a proxy caching server? Explain its configuration and benefits for network performance and bandwidth management. [1+4]

Show solved answer

Proxy Caching Server: Definition, Configuration, and Benefits

1. Definition of Proxy Caching Server

A proxy caching server is an intermediary server that sits between client computers and origin servers (web servers). It intercepts client requests, stores copies of frequently accessed web content locally, and serves that cached content to subsequent requests without fetching from the origin server again.

The proxy acts as a "middleman" that:

  • Receives HTTP requests from clients
  • Checks if requested content exists in its cache
  • Returns cached content if available (cache hit)
  • Forwards requests to origin servers if content is not cached (cache miss)
  • Stores responses for future use

2. Configuration of Proxy Caching Server

Key Configuration Parameters:

a) Cache Storage

  • Define cache directory location and total cache size (e.g., 1GB, 10GB)
  • Set maximum object size to cache (e.g., don't cache files > 100MB)
  • Configure cache replacement policy (LRU - Least Recently Used, LFU - Least Frequently Used)

b) Cache Expiration (TTL - Time To Live)

  • Set expiration time for different content types
  • Static content: longer TTL (e.g., 7 days)
  • Dynamic content: shorter TTL (e.g., 1 hour)
  • Configure based on HTTP headers (Cache-Control, Expires)

c) Access Control

  • Define which clients can use the proxy
  • Specify allowed/blocked domains
  • Set authentication requirements

d) Refresh Policies

  • Configure when to revalidate cached content with origin server
  • Set conditional request headers (If-Modified-Since, ETag)

e) Logging and Monitoring

  • Enable access logs to track cache hits/misses
  • Monitor cache performance metrics

3. Benefits for Network Performance and Bandwidth Management

Network Performance Benefits:

BenefitExplanation
Reduced LatencyCached content served locally is much faster than fetching from distant origin servers
Faster Response TimesUsers experience quicker page loads and downloads
Reduced Server LoadOrigin servers handle fewer requests, improving their response time
Better User ExperienceFaster access to frequently used content

Bandwidth Management Benefits:

BenefitExplanation
Bandwidth SavingsRepeated requests for same content don't consume WAN bandwidth; served from local cache
Reduced WAN TrafficCan reduce outbound bandwidth by 30-70% depending on content patterns
Lower ISP CostsLess data transferred = lower bandwidth bills
Efficient Resource UtilizationNetwork links used more efficiently for new/unique content
Congestion ReductionFewer requests traverse the network backbone

Example Impact:

If 100 users request the same 5MB file:

  • Without proxy cache: 500MB transferred over WAN
  • With proxy cache: 5MB transferred (first request only) + local distribution

Conclusion: Proxy caching servers are essential infrastructure for optimizing network performance and controlling bandwidth costs, particularly in organizations with high internet usage or limited WAN capacity.

Open this answer on its own page →

SMTP, POP3, and IMAP email protocols

2082.1 · 5 marks

Explain the roles of SMTP, POP3, and IMAP in email communication. [5]

Email communication requires multiple protocols working together. SMTP, POP3, and IMAP are the three fundamental protocols that handle different aspects of email transmission and retrieval. --- Role: Sending and relaying emails - Function: SMTP is responsible for sending emails from a client to a...

Open this answer on its own page →