Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Strange characters on nginx
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message

Joined: 26 Nov 2012
Posts: 1
Location: Rio, Brazil

PostPosted: Mon Nov 26, 2012 3:54 pm    Post subject: Strange characters on nginx Reply with quote

Hi all,
I'm struggling with this issue for days. I have a server with nginx and php on Gentoo, and some international characters are not showing correctly. Here's my nginx.conf:

user nginx nginx;
worker_processes 1;

error_log /var/log/nginx/error_log info;

events {
   worker_connections 1024;
   use epoll;

http {
   include /etc/nginx/mime.types;
   default_type application/octet-stream;

   log_format main
      '$remote_addr - $remote_user [$time_local] '
      '"$request" $status $bytes_sent '
      '"$http_referer" "$http_user_agent" '

   client_header_timeout 10m;
   client_body_timeout 10m;
   send_timeout 10m;

   connection_pool_size 256;
   client_header_buffer_size 1k;
   large_client_header_buffers 4 2k;
   request_pool_size 4k;

   gzip on;
   gzip_min_length 1100;
   gzip_buffers 4 8k;
   gzip_types text/plain;
   gzip_disable "MSIE [1-6]\.(?!.*SV1)";

   output_buffers 1 32k;
   postpone_output 1460;

   sendfile on;
   tcp_nopush on;
   tcp_nodelay on;

   keepalive_timeout 75 20;

   ignore_invalid_headers on;

   index index.html index.php;

   server {
      listen 80;

      access_log /var/log/nginx/workflow.access_log main;
      error_log /var/log/nginx/workflow.error_log info;

      root /var/www/modulo;

      location ~ \.php$ {
             include /etc/nginx/fastcgi_params;
             fastcgi_pass unix:/var/run/php-fpm.socket;
             fastcgi_index index.php;
             fastcgi_param  SCRIPT_FILENAME /var/www/modulo$fastcgi_script_name;

      location "/anexos" {
                        autoindex on;

And when I load the page by browser, international characters do not appear correctly.

Also, I already have tried to check the page header, and it seems correct (the meta information on php pages are all iso-8859-1).
$ curl -I
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Mon, 26 Nov 2012 12:13:00 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.4.6--pl0-gentoo
Set-Cookie: PHPSESSID=mer339creb1b4eiur8j9o3hki7; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache

I have tried to change charset in pages and in nginx.conf to utf-8, without success. And here's the output of "export" command.
declare -x CONFIG_PROTECT_MASK="/etc/gentoo-release /etc/sandbox.d /etc/php/cli-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/terminfo /etc/ca-certificates.conf /etc/revdep-rebuild"
declare -x EDITOR="/usr/bin/vi"
declare -x GCC_SPECS=""
declare -x HOME="/root"
declare -x HUSHLOGIN="FALSE"
declare -x INFOPATH="/usr/share/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.22/info"
declare -x LANG="pt_BR.ISO-8859-1"
declare -x LC_COLLATE="C"
declare -x LC_CTYPE="pt_BR.ISO-8859-1"
declare -x LESS="-R -M --shift 5"
declare -x LESSOPEN="|lesspipe %s"
declare -x LOGNAME="root"
declare -x MAIL="/var/mail/root"
declare -x MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.22/man:/usr/lib64/php5.4/man/"
declare -x MULTIOSDIRS="../lib64:../lib32"
declare -x OLDPWD
declare -x PAGER="/usr/bin/less"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.4"
declare -x PWD="/root"
declare -x PYTHONPATH="/usr/lib/portage/pym"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x TERM="linux"
declare -x USER="root"

Additional info:
pt_BR ISO-8859-1
pt_BR.UTF-8 UTF-8
en_US ISO-8859-1
en_US.UTF-8 UTF-8


Also, when someone uploads through the php application a file containing international characters, he's not able anymore to download it from /anexos, since it appears that the server is encoding the link in a different charset.

Appreciate any help, thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum