nginx不支持中文URL路径问题

1、查看当前系统所使用的语言类型:

使用 "locale" 命令: 
 
locale :查看当前系统的语言类型
lcoale -a : 查看 当前系统所支持的所有语言类型!

临时修改 语言类型:

LANG="zh_CN.UTF-8"
 # 只是临时的,当你重新打开一个终端即失效!
 
 "# 一般情况下,大家的路径都是 /etc/sysconfig/i18n"
 
如果你的计算机里没有这个文件怎么办?
其实也很简单:
 
# Centos 系统 : /etc/locale.conf 
# Ubuntu 系统 : /etc/locale.gen (我这里用的是aliyun的云服务器)
 
为什么这里会使用这个文件呢?这个跟 "Linux正常启动的时候加载的环境变量文件"有关! 
 
 
 ###查找文件路径
# 查看你的 /etc/profile.d/lang.sh 文件
 11   for langfile in /etc/locale.conf "$HOME/.i18n" ; do
 12         [ -f $langfile ] && . $langfile && sourced=1
 13     done
:set nu
看见没 ,上面有个路径 "/etc/locale.conf"  这个就是相当于 "/etc/sysconfig/i18n"  
 
 
 
打开/etc/locale.conf修改lang
 
LANG="zh_CN.UTF-8"
 
 
 
最后重启系统

2、nginx配置文件编码设置为utf-8

加入 charset utf-8;

 server {
        listen       80;
        server_name  localhost;
        charset utf-8;
        #charset koi8-r;
 
        #access_log  logs/host.access.log  main;
 
        location / {
            root   html;
            index  index.html index.htm;
        }
 
        #error_page  404              /404.html;
 
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

3、xftp的字符集设置为UTF-8

再重新上传一下部署文件

游荡时间:
到此一游: xoxu