1. 程式人生 > >對中文網址和中文路徑的支援

對中文網址和中文路徑的支援

一直說可以用中文網址了,於是我申請了一個 技術支援.線上
繫結到一個ip上,為了防止這個ip被攻擊,就不寫出了,下面用A.B.C.D表示,然後我在centos上curl一下

[~]$ curl 雲端計算。技術支援。線上/金山 -v
* Input domain encoded as `UTF-8'
* About to connect() to xn--9kqp11i6bk.xn--2qu2kx9cr0c.xn--3ds443g port 80 (#0)
*   Trying <A.B.C.D>...
* Connected to 雲端計算。技術支援。線上 (A.B.C.D)
port 80 (#0) > GET /金山 HTTP/1.1 > User-Agent: curl/7.29.0 > Host: xn--9kqp11i6bk.xn--2qu2kx9cr0c.xn--3ds443g > Accept: */* > < HTTP/1.1 200 OK < Server: CLOUD ELB 1.0.0 < Date: Thu, 20 Sep 2018 10:09:46 GMT < Content-Type: application/octet-stream < Content-Length: 183 < Connection: keep-alive <
[2018-09-20T18:09:46+08:00]http server<vm10-0-0-10.ksc.com> [] in 100.68.80.2:6794 -> _, xn--9kqp11i6bk.xn--2qu2kx9cr0c.xn--3ds443g, (RS:10.0.0.10:8000), 0 bytes send by curl/7.29.0 * Connection #0 to host 雲端計算。技術支援。線上 left intact

curl成功,說明ksyun的網路支援中文
再試試域名解析,dig一把

[~]$ dig 雲端計算。技術支援。線上

; <<>> DiG 9.9.4-RedHat-9.9.4-51.el7_4.2 <<
>> 雲端計算。技術支援。線上 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44569 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4000 ;; QUESTION SECTION: ;雲端計算.技術支援.線上. IN A ;; ANSWER SECTION: 雲端計算.技術支援.線上. 62 IN A A.B.C.D ;; Query time: 5 msec ;; SERVER: 192.168.12.19#53(192.168.12.19) ;; WHEN: Thu Sep 20 18:09:49 CST 2018 ;; MSG SIZE rcvd: 87

nginx的log檔案

配置檔案格式

 "$time_iso8601 $remote_addr:$remote_port $server_addr:$server_port $upstream_addr $request_time $upstream_response_time $status $upstream_status $request_length $body_bytes_sent \
"$request_method $scheme://$http_host$request_uri $server_protocol\" \"$http_referer\" \"$http_user_agent\"";

結果

2018-09-20T18:09:46+08:00 114.255.44.141:49632 A.B.C.D:80 10.0.0.10:8000 0.001 0.001 200 200 112 183 “GET http://雲端計算.技術支援.線上/\xE9\x87\x91\xE5\xB1\xB1 HTTP/1.1” “-” “curl/7.29.0”

結果:金山雲是可以完美的支援中文域名和路徑的。