Environment: Windows 10 + nginx/1.8.0. The files in the mysql directory are all in UTF-8 encoding, and all HTML files in mysql contain <meta charset="utf-8" />.
My configuration file for file nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
charset gbk,utf-8;
source_charset gbk,utf-8;
autoindex on;
location / {
root d:/mydoc/build/html;
index index.html index.htm;
charset gbk,utf-8;
source_charset gbk,utf-8;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
I start my nginx server and open the mysql directory in Firefox:
All CJK characters are shown correctly. Now to click the third third title----mysql日志.html:
Display file error.log to check what happened:
2020/12/05 22:41:19 [error] 11252#11076: *8 CreateFile() "d:/mydoc/build/html/mysql/mysql日志.html" failed
(2: The system cannot find the file specified),
client: 127.0.0.1, server: localhost, request:
"GET /mysql/mysql%C8%D5%D6%BE.html HTTP/1.1", host: "127.0.0.1", referrer: "http://127.0.0.1/mysql/"
Input http://127.0.0.1/mysql/mysql日志.html in my Firefox and click. All CJK characters are shown correctly.
How do I solve the issue that it jump into a webpage containing garbled CJK characters when to click title in 127.0.0.1/mysql?
It is verified that for same directory and files CJK character can shown correctly in nginx + Linux instead of nginx + Windows.
Following the alibabacloud guide, my best guess is that you should use only charset utf-8 and you should also check that all filenames are in UTF-8 format or convert to UTF-8 otherwise (only filenames, not the content).