Complete the code to listen on HTTP port 80.
server {
listen [1];
server_name example.com;
}Port 80 is the default port for HTTP traffic.
Complete the code to redirect all HTTP requests to HTTPS.
server {
listen 80;
server_name example.com;
return [1] https://$host$request_uri;
}301 is the status code for permanent redirect, used to send HTTP to HTTPS.
Fix the error in the HTTPS server block to enable SSL.
server {
listen 443 ssl;
server_name example.com;
ssl_certificate [1];
ssl_certificate_key /etc/ssl/private/example.key;
}The ssl_certificate directive must point to the SSL certificate file, usually a .crt file.
Fill both blanks to complete the HTTPS server block with root and index directives.
server {
listen 443 ssl;
server_name example.com;
root [1];
index [2];
}The root directive sets the folder for website files, and index sets the default file to serve.
Fill all three blanks to complete a secure HTTPS server block with SSL protocols and ciphers.
server {
listen 443 ssl;
server_name example.com;
ssl_protocols [1];
ssl_ciphers [2];
ssl_prefer_server_ciphers [3];
}These settings enable modern TLS versions, strong ciphers, and prefer server cipher order for security.
