Hello,

I tried to set the Charset of a virtual host like this:

server {
        root /var/www/mywebsite.com;

...

        charset iso-8859-1;
        override_charset on;

...

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
                charset iso-8859-1;
                override_charset on;

        }
}

I have specified charset and overried_charset on both server and location and yet, it was still sending headers in UTF-8.

I had to modify the php.ini file from /etc/php/7.2/fpm/php.ini to specify in it default_charset = "iso-8859-1".

But I would like to let my php set to UTF-8 and specify on Nginx only for only one virtual host iso-8859-1.

On Apache we can do:

<VirtualHost mywebsite.com:80>
...
    Header set Content-Type "text/html; charset=iso-8859-1"
</VirtualHost>

How to do the same on Nginx?

Thanks,

Vincent.

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to