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 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 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;
    }
}
2周前 评论
xiaotuantuan (楼主) 2周前
陈先生

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

2周前 评论
xiaotuantuan (楼主) 2周前

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