I am trying to set up a server with a domain name called "privatinstruktør.dk" but keeps getting redirected to the default "welcome to nginx" page.
I have tried to type in the server_name like this:
server {
listen 80;
server_name privatinstruktør.dk;
location / {
root /var/www/privat;
}
}
but that did not work. So I tried using regular expressions like:
server_name "~^privatinstrukt(.+)r\.dk$";
and
server_name "~^privatinstrukt(.*)r\.dk$";
and even
server_name "~^privat(.*)$";
But all fails and I am redirected to the default page. Does anyone have a hint on how to fix this?
On the other side, server_name _; defines an invalid server names which never intersect with any real name. It is just a non-match. So in the event of no matches, nginx will select the first server{} block and use that. To conclude, you can use server_name _; for catch-all server block but not server_name ""; .
The DNS actually allows any characters in a domain name, and a Unicode name, with a UTF-8 type encoding, would probably be accepted as is by the server, which would confuse applications prompting them to convert it into Punycode. If you register a name with a domain name registry, you will often go through a registrar.
$http_host contains the content of the HTTP "Host" header field, if it was present in the request. $server_name contains the server_name of the virtual host which processed the request, as it was defined in the nginx configuration.
Configure a Unicode domain name using punycode format in nginx:
server_name xn--privatinstruktr-jub.dk;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With