File: //etc/nginx/sites-available/dakarash.conf
server {
if ($host = www.dakarash.co.id) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = dakarash.co.id) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name dakarash.co.id www.dakarash.co.id;
# ACME HTTP-01 (Let's Encrypt)
location ^~ /.well-known/acme-challenge/ {
root /home/dakarash.co.id/public_html;
default_type "text/plain";
try_files $uri =404;
}
# Redirect semua ke HTTPS (canonical non-www)
location / {
return 301 https://dakarash.co.id$request_uri;
}
}