13. Multiple Websites on One Server and HTTPS with Certbot
13.5 Checking and Hardening Your TLS Setup
Padlock disla mhanje kaam sampla asa nahi. TLS versions, certificate aani security headers check karuya.
openssl s_client -connect yourdomain.com:443 -servername yourdomain.com </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates
openssl s_client -connect yourdomain.com:443 -tls1_1 </dev/null # should FAIL (old version)
curl -sI https://yourdomain.com | grep -i strict-transport
# Nginx – inside the 443 server block (Certbot creates it)
ssl_protocols TLSv1.2 TLSv1.3;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Apache – inside <VirtualHost *:443> (needs: sudo a2enmod headers on Ubuntu)
SSLProtocol -all +TLSv1.2 +TLSv1.3
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
| Check | Good result |
|---|---|
| Protocols | Only TLS 1.2 and 1.3 |
| Certificate | Matches the domain, not expired, full chain |
| Redirect | HTTP → HTTPS with 301 |
| HSTS header | Present, after you are sure HTTPS works everywhere |
Online checkers such as SSL Labs (ssllabs.com/ssltest) grade a public configuration – use them only on your own domain.
Why this matters for security
HSTS (कठोर HTTPS धोरण) tells browsers never to use HTTP for your site again, which defeats SSL-stripping attacks on public Wi-Fi. Old protocols (SSLv3, TLS 1.0/1.1) have known weaknesses and are flagged by every vulnerability scanner.
Ravindra Bagale's Tip
HSTS includeSubDomains sobat laavla aani ekhada subdomain ajun HTTP var aahe – to browsers madhe band padto! Khup students la he nantar kalte. Aadhi sagle subdomains HTTPS var aahet ka te check kara, mag HSTS laava.
Practice task
Check your certificate dates with openssl, confirm TLS 1.1 is refused, add HSTS and verify the header with curl -sI.
Thodkyaat sangaycha tar
- One IP can host many sites; the
Hostheader picks the server block / virtual host. - Nginx: one
server {}per site (conf.d/on Amazon Linux;sites-available+ symlink on Ubuntu) + a catch-alldefault_serverreturning 444. - Apache: one
<VirtualHost>per site (conf.d/on Amazon Linux;a2ensiteon Ubuntu); the first loaded is the default. - Test without DNS:
curl -H "Host: name" http://localhostor thehostsfile. - Certbot:
sudo certbot --nginx|--apache -d name --redirect;certbot renew --dry-run. - Harden TLS: only TLS 1.2/1.3; HSTS once HTTPS works everywhere.
Samjla ka? Part 6 sampla – tumhi aata real domain var HTTPS site chalavu shakta! Aata pudhe jaauya AWS S3 aani RDS kade.