Nginx config Chinese domain name

Source: Internet
Author: User

Today encountered a fun problem, also thought is nginx cache, all kinds of cleanup is bad to the Nginx uninstall, and then think about the problem should be Chinese domain name, the Chinese code, done, as follows:

... server {        listen       ;        server_name  abc.cn;        Root/home/abc/abcpage;           index/1/abcpage.html;    } server {        listen       ;        server_name  Chinese. cn;        Root/home/123/123page;           index/1/123page.html;    } ...

Enter Chinese on the browser URL. CN should be able to jump to 123page.html but jump to abcpage.html.

Finally found that the Chinese domain name conversion to Punycode code can be identified by Nginx

(Under the Encyclopedia: Punycode is a coding system based on the RFC 3492 standard, which is mainly used to convert a domain name from a Unicode encoding used in a local language into a code that can be used in a DNS system. Punycode can prevent the so-called IDN spoofing)

Find an online conversion tool: http://tools.jb51.net/punycode/, as follows:

The configuration file is changed to:

... server {        listen       ;        server_name  abc.cn;        Root/home/abc/abcpage;           index/1/abcpage.html;    } server {        listen       ;        server_name  xn--fiq228c.cn;        Root/home/123/123page;           index/1/123page.html;    } ...

Then visit Chinese. cn to jump to 123page.html!

Nginx config Chinese domain name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.