Monday, August 26, 2019

Nginx下使用中文URL和中文目錄路徑

一、確定你的Linux系統是UTF編碼,Root登錄SSH:

env|grep LANG
LANG=en_US.UTF-8

二、NGINX配置文件里默認編碼設置為utf-8

server
{
listen 80;
server_name .inginx.com ;
index index.html index.htm index.php;
root /usr/local/nginx/html/inginx.com;
charset utf-8;
}

三、如果使用putty
windows –> translation –>UTF-8

mkdir 中文目錄名
echo ‘中文目錄名’ > 中文目錄名/中國.html

四、如果是用securecrt 上傳文件,請選擇 回話–>外觀–UTF-8
如果是FTP軟件也將默認編碼設置為TUF-8

五、如果上傳的文件名出現亂碼顯示
執行

for f in `ls *.html` ; do mv $f `ls $f|iconv -f GBK -t UTF-8`; done

完畢。

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.