?1、網頁代碼設置utf-8編碼格式,內容參考如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>簡體中文標題</title>
</head>
<body>
<center>簡體中文內容</center>
</body>
</html>
2、nginx服務端的nginx.conf設置utf-8編碼格式。需要注意的是server層和訪問路徑location都要配置。?
server {
listen 80;
server_name houzhigao.com;
charset utf-8;
location / {
root index;
index index.html index.htm;
}
}
3、修改了nginx的配置文件,需要重新加載一下nginx。
執(zhí)行:
nginx -s reload
或執(zhí)行:文章來源:http://www.zghlxwxcb.cn/news/detail-506412.html
/usr/local/nginx/sbin/nginx -s reload
4、最后訪問測試:中文解析正常。文章來源地址http://www.zghlxwxcb.cn/news/detail-506412.html
到了這里,關于nginx訪問頁面中文亂碼解決方案的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!