GET /index.html HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Accept: text/html
							HTTP/1.1 200 OK
Content-Type: text/html
<html>
  <body>
    <h1>Welcome to Example.com</h1>
  </body>
</html>
							Key benefits:
// Example: HTTPS request in C++
#include <cpprest/http_client.h>
int main() {
    web::http::client::http_client client(U("https://example.com"));
    auto response = client.request(web::http::methods::GET).get();
    std::wcout << "Response: " << response.status_code() << std::endl;
    return 0;
}
							// Example: HTTPS request in JavaScript (Web)
fetch('https://example.com', {
    method: 'GET' // HTTP method (GET, POST, etc.)
})
.then(response => {
    if (!response.ok) {
        throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return response.text(); // or response.json() if the response is JSON
})
.then(data => {
    console.log('Response Data:', data); // Log the response data
})
.catch(error => {
    console.error('Error:', error); // Handle errors
});
// Example: HTTPS request in Node.js
const https = require('https');
const options = {
    hostname: 'example.com',
    port: 443,
    path: '/',
    method: 'GET'
};
const req = https.request(options, (res) => {
    console.log(`Status Code: ${res.statusCode}`);
    res.on('data', (d) => {
        process.stdout.write(d);
    });
});
req.on('error', (e) => {
    console.error(`Error: ${e.message}`);
});
// End the request
req.end();
# Install Certbot to obtain a certificate
sudo apt install certbot python3-certbot-nginx
# Obtain an SSL certificate for your domain
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
# Certbot will automatically configure Nginx to use the certificate
							# Example Nginx HTTPS configuration with HSTS
server {
    listen 443 ssl;
    server_name yourdomain.com;
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
    add_header Strict-Transport-Security "max-age=31536000" always;
}
							Example:
http://example.com
https://example.com (ranked better)| Feature | Apache | Nginx | 
|---|---|---|
| Architecture | Process-based | Event-driven | 
| Static Content | Slower at serving static files | Optimized for static files | 
| Dynamic Content | Better suited for PHP/CGI | Usually paired with FastCGI | 
| Reverse Proxy | Supported via modules | Built-in reverse proxying | 
| Configuration | Per-directory (.htaccess) | 
Centralized (one config file) | 
| Concurrency | Not optimized for high concurrency | Excellent for handling many connections | 
| Memory Usage | Higher memory usage per connection | Low memory usage per connection | 
.htaccess)..htaccess and mod_rewrite.Caddyfile..htaccess allows per-user configurations.Choose the server that best fits your traffic, content, and infrastructure needs.
.htaccess files are necessary for user-level customizations.| Feature | HTTP/2 | HTTP/3 | 
|---|---|---|
| Transport Protocol | TCP (Transmission Control Protocol) | QUIC (built on UDP) | 
| Multiplexing | Supported, but head-of-line blocking can occur on packet loss | Fully multiplexed with no head-of-line blocking | 
| Connection Setup | Requires multiple RTTs for TCP and TLS | Faster connection setup due to combined transport and TLS handshake | 
| Encryption | Optional (but commonly used with HTTPS) | Always encrypted (TLS 1.3 by default) | 
| Packet Loss Handling | Affects all streams (head-of-line blocking) | Losses are handled per stream without blocking others | 
| Deployment | Widely deployed and mature | Newer, not as widespread but growing fast | 
mod_http2 module.--with-http_v2_module.# Enabling HTTP/2 in Nginx
server {
    listen 443 ssl http2;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;
}
							# Enabling HTTP/3 in Nginx (experimental)
server {
    listen 443 ssl http2;
    listen 443 quic reuseport;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;
    http3_max_concurrent_streams 128;
}