GROUP 13 - Web Hosting
GROUP 13 - Web Hosting
Below are key components in the web application stack that use HTTP:
Application Server
Runs web application code and connects with web servers
Examples: Unicorn, Tomcat
Cache
Speeds up access to frequently requested content
Examples: Varnish, Squid
Load Balancer
Distributes requests across multiple systems for efficiency
Examples: Pound, HAProxy
Web Application Firewall (WAF)
Inspects HTTP traffic to block common cyberattacks
Example: ModSecurity
Web Server
Serves static files (HTML, images, etc.) and connects to other servers
Examples: Apache, NGINX
Web Proxy
Acts as an intermediary, forwarding HTTP requests to their destination
Often transparent to clients; used in load balancing and firewalls
WEB HOSTING IN
THE CLOUD
The hosting of web applications has been completely
transformed by cloud computing. For traditional methods to
guarantee high availability and performance, costly, over-
provisioned infrastructure was needed.
scalable infrastucture
cost-effective models
reliable
Choosing the Right MPM: The worker and event MPMs allow
for a balance between performance and resource usage
compared to the prefork model.
Connection Handling: Enable features like KeepAlive to
allow persistent connections and reduce overhead.
File Delivery Optimizations: Utilize features such as sendfile
and memory-mapping (mmap) where supported.
PERFORMANCE TUNING AND
OPTIMIZATION
Commands:
- 'nginx -c' to specify config file
- 'nginx -t' to test config syntax
• Stop NGINX:
-sudo systemctl stop nginx
• Restart NGINX:
-sudo systemctl restart nginx
IMPORTANT NGINX COMMANDS &
EXAMPLES
•Reload configuration:
-sudo nginx -s reload
location /nginx/ {
proxy_pass http://nginx.org/;
}
-ssl_certificate /etc/ssl/certs/admin.com.crt;
-ssl_certificate_key /etc/ssl/private/admin.com.key;
IMPORTANT NGINX COMMANDS &
EXAMPLES
• Load balancing example:
- upstream admin-servers {
server web1.admin.com:8080;
server web2.admin.com:8080;
}
HAPROXY
Key Concepts, Configuration
& Use Cases
WHAT IS HAPROXY?
HAProxy (High Availability Proxy) is an open-source
software widely used for load balancing and proxying TCP
and HTTP-based applications.
Highlights:
Supports sticky sessions
Advanced health checks
TLS and IPv6 support
HTTP compression
HTTP/2 (in development)
HAPROXY CONFIGURATION BASICS
Config file: haproxy.cfg
Location examples:
Debian/RHEL: /etc/haproxy/haproxy.cfg
FreeBSD: /usr/local/share/examples/haproxy
frontend http-in
bind *:80
default_backend webservers
backend webservers
balance roundrobin
server web1 10.0.0.10:8080
server web2 10.0.0.11:8080
FRONTEND AND BACKEND EXPLAINED
Frontend:
Receives client requests — defines port, IP, protocol.
Backend:
Sends requests to the right server — handles
routing and load balancing.
TIMEOUT AND PERFORMANCE TUNING
frontend https-in
bind *:443 ssl crt /etc/ssl/private/admin.com.pem
default_backend webservers