I'm trying to configure the Caddyfile to allow accessing my website build on an Azure virtual machine via custom domain.
Here is my Caddyfile:
DOMAIN_NAME=azuredomain.northeurope.cloudapp.azure.com:80
{$DOMAIN_NAME} {
# HTTPS options:
# tls {$TLS_EMAIL}
# Test HTTPS setup
# tls {$TLS_EMAIL} {
# ca https://acme-staging-v02.api.letsencrypt.org/directory
# }
# Removing some headers for improved security:
header / -Server
# Serves static files, should be the same as `STATIC_ROOT` setting:
root /var/www/django
# Serving dynamic requests:
proxy / django:8000 {
except /static /media
transparent
websocket
}
# Allows to use `.gz` files when available:
gzip
# Logs:
log stdout
errors stdout
}
I have created 2 CNAME in my custom domain, which is subdomain.domain.com:
www.subdomain.domain.com. 600 CNAME
azuredomain.northeurope.cloudapp.azure.com
subdomain.domain.com. 600 CNAME
azuredomain.northeurope.cloudapp.azure.com
I can access the website from azuredomain.northeurope.cloudapp.azure.com, but not from my custom domain: subdomain.domain.com
The error I get is:
404 Site subdomain.domain.com is not served on this interface
nslookup subdomain.domain.com
Gives:
Non-authoritative answer:
subdomain.domain.com canonical name = azuredomain.northeurope.cloudapp.azure.com
Name: azuredomain.northeurope.cloudapp.azure.com
Address: <I have hidden the address for privacy concenrs>
I don't understand what I'm doing wrong here. How can I access the website build on azure from my custom domain?