3.Nginx靜態html出現中文亂碼


Nginx靜態html出現中文亂碼

配置完reload一下nginx,實在不行都配置一下

1.在html頁面中加入meta標簽

網頁代碼設置utf-8編碼格式

<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

2.在nginx.conf設置utf-8編碼格式

server層配置 或者 server層和訪問路徑location都要配置

server {
        listen 81;
        set $root F:/Develop/nginx-1.14.0/html;
        root $root; 
        server_name  localhost;
        access_log  logs/host.access.log  main;
        index index.html index.php;
        # server層設置字符集
        charset utf-8;

        location / {
            root html;
            index index.html index.htm;
            charset utf-8; # location層設置字符集
        }
    }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM