mac环境下Nginx运行 PHP 项目乱码?

mac下apache运行该项目正常,
但使用 nginx运行该项目乱码 (其他项目正常)
且项目放到阿里云 ecs下 NGinx运行该项目也正常没有乱码。
有人遇到过类似的问题吗?】
nginx尝试设置charset UTF-8;无效果

mac环境下Nginx运行 PHP 项目乱码?


server{
        listen 8080;
        root /usr/local/var/www/pb_02;
charset UTF-8;
 access_log /logs/a_access.log;
error_log /logs/b_error.log;
        location /{
                 index  index.html  index.htm;
                try_files $uri $uri/ /index.php?$query_string;
               charset UTF-8;
        }

        location ~ \.php$ {
             root /usr/local/var/www/pb_02;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
            charset UTF-8;
        }
}
本作品采用《CC 协议》,转载必须注明作者和本文链接
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
讨论数量: 4

会不会是 nginx 没有重启...

server {
    listen 8080;
    root /usr/local/var/www/pb_02;
    access_log /logs/a_access.log;
    error_log /logs/b_error.log;
    charset utf-8;

    location / {
        index  index.html  index.htm;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}
1年前 评论
xiaotuantuan (楼主) 1年前

看下响应(Response)的字符集是什么

1年前 评论
xiaotuantuan (楼主) 1年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!