• Serveurs
  • [Problème] Nginx ne prend pas en compte l'utf-8

Ainsi, c'était bien ça ^^. C'est en effet bizarre...

C'est exact. Un fichier .htaccess ne fonctionnera pas, Nginx n'a pas était conçu pour.
Bien, plus qu'à voir si c'est fiable. J'en ai entendu parler mais sans plus.
Mouais, ça marche pas des masses ^^

.htaccess
# Url Rewriting
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([_a-z0-9]*).html$  template.php?url=$1 [L]
website.conf
    location / {
        root /var/www;
        include /etc/nginx/conf.d/php;
        include /etc/nginx/conf.d/cache;                                                                                                                                                                                                    $
        rewrite ^/([_a-z0-9]*).html$ /template.php?url=$1
        break;
    }
Bonjour colle ceci dans ton header ou les fichiers concernés de ton site cela va rectifier les problemes de caracteres
<?php

header('Content-Type: text/html;charset=ISO-8859-1');

?>
Cela va resoudre ton probléme
Merci olivers, mais j'ai corrigé le problème ^^

Maintenant celui qui se pose c'est le regex... Je sais pas s'il est correct (du moins avec apache ça tournait 😀), ou si le problème provient de Nginx 😐

Et après je passerais à cakebox-light -_-
Je m'y connais peu en regex et l'url rewriting... Du moins, je doute qu'il existe des différences dans le cas présent pour la regex. Ainsi, je pencherais plutôt sur un défaut de la config de Nginx mais quoi ?
Déjà il doit se situé dans le fichier de conf, entre location / { ... }

Sur apache celui du .htaccess, ça marche impec'. Cependant lorsque je le teste sur des sites j'ai l'impression qu'il merde

J'essaye de récupérer la variable $url dans index.php.

En gros www.mondomaine.fr/index.php?url=monlien
devient www.mondomaine.fr/monlien

Il faudrait réecrire "index.php?url=" et chopper "monlien"
Pour revenir à Cakebox :

Rutorrent marche parfaitement à l'adresse rutorrent.mondomaine.fr

Cependant cakebox m'affiche une erreur 502. Le sous domaine a été mis en place. (c'était rapide pour celui de rutorrent).

J'ai crée le fichier "/var/www/cakebox/config/sqdz.php" et "/etc/nginx/sites-enabled/cakebox.conf".

cakebox.conf :
server {
    listen 80;
    server_name cakebox.mondomaine.fr; ## sous domaine obligatoire // j'ai modifié mondomaine par le vrai [img]/assets/images/smileys/wink.png[/img]

    root /var/www/cakebox/public;
    index index.php;

    auth_basic "seedbox";
    auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";

    charset utf-8;
    include /etc/nginx/conf.d/cache;

    access_log /var/log/nginx/cakebox-access.log;
    error_log /var/log/nginx/cakebox-error.log;

    location = / {
        try_files @site @site;
    }

    location / {
        try_files $uri $uri/ @site;
    }

    location /sqdz/ {
        alias /home/sqdz/torrents/;
        add_header Content-Disposition "attachment";
        satisfy any;
        allow all;
    }

    ## etc si d'autre utilisateur ##

    location @site {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_param APPLICATION_ENV production;

        ## uncomment when running via https
        ## fastcgi_param HTTPS on;
    }
}
Une idée ?
Bon.. j'ai supprimé cakebox-light, recommencé le tuto de A à Z. Toujours l'erreur 502 :-/

Logs de cakebox :
2014/05/17 14:23:14 [crit] 1040#0: *768 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET / HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr"
2014/05/17 14:23:14 [crit] 1040#0: *768 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET /favicon.ico HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr"
2014/05/17 14:23:14 [crit] 1040#0: *768 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET /favicon.ico HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr"
2014/05/17 15:44:54 [crit] 5763#0: *8 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET / HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr"
2014/05/17 15:44:57 [crit] 5763#0: *8 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET / HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr"
2014/05/17 15:44:57 [crit] 5763#0: *8 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET / HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr"
2014/05/17 15:47:23 [crit] 5766#0: *90 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET / HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr", referrer: "http://rutorrent.mondomaine.fr/"
2014/05/17 15:55:03 [crit] 5766#0: *545 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upcakebox, client: 82.236.180.50, server: cakebox.mondomaine.fr, request: "GET / HTTP/1.1", upcakebox: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cakebox.mondomaine.fr", referrer: "http://rutorrent.mondomaine.fr/"

EDIT : Je devais être un peu dans le gaz pendant l'installation de rtorrent...
J'avais oublié de modifier LISTEN (listen = /var/run/php5-fpm.sock)

EDIT 2 : En modifiant cette variable, cela casse ma config rutorrent et website. (qui devient du coup indisponible.. >_<')

Un petit soucis avec "/etc/php5/fpm/pool.d/www.conf". Lorsque je passe LISTEN = 127.0.0.1:9000 Rutorrent, mon site tourne, cakebox plante. Lorsque j'indique /var/run/php5-fpm.sock Cakebox marche, mais le reste plante
Pour terminer :
LISTEN = 127.0.0.1:9000 -> Rutorrent + website OK // cakebox plante.
LISTEN = /var/run/php5-fpm.sock -> Rutorrent + website plantent // cakebox ok.

J'ai vu que rutorrent utilise du SCGI et cakebox du fastcgi (si je ne m'abuse ?)

Bref, j'ai finis par supprimer cakebox. Je stream via ftp avec XBMC (directement sur la télé), c'est beaucoup plus pratique pour moi ^^.

Cependant si quelqu'un peut m'expliquer le problème, ma curiosité en serait ravi (même 1an plus tard ) J'ai bien compris ce que fait le CGI, mais je reste coincer sur ce problème
Répondre…