[英]Unicode domain name in Nginx server_name
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.我正在尝试使用名为“privatinstruktør.dk”的域名设置服务器,但一直被重定向到默认的“欢迎使用 nginx”页面。
I have tried to type in the server_name like this:我试图像这样输入 server_name :
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?
有没有人有关于如何解决这个问题的提示?
在nginx中使用punycode格式配置一个Unicode域名:
server_name xn--privatinstruktr-jub.dk;
Use only the Punycode name:仅使用Punycode名称:
server {
listen 80;
server_name xn--privatinstruktr-jub.dk;
location / {
root /var/www/privat;
}
}
which is what the Nginx Docs say:这就是Nginx 文档所说的:
Internationalized domain names (IDNs) should be specified using an ASCII (Punycode) representation in the server_name directive
国际化域名 (IDN) 应在 server_name 指令中使用 ASCII(Punycode)表示指定
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.