Bonjour,
Je me permet de créer ce post car après plusieurs heures de recherche, je n'arrive pas à résoudre un petit problème:
J'ai récemment installé Nginx sur mon raspberry Pi3, que j'ai couplé à php7 et mysql.
J'ai donc fait une petite config pour tester si Nginx fonctionne avec les domaines et sous-domaine que je voudrais utiliser plus tard sur mon site... Et c'est la que c'est bizarre:
Quand je me connecte à mon "site test" avec l'adresse IP de ma freebox, ça marche... tout va bien...
Mais quand je veux me connecter par l’intermédiaire de mon nom de domaine,
parfois ca marche (en fonction du navigateur utilisé)... Mais souvent nGinx me renvoie une erreur 400 Bad Request.
Alors évidemment, j'ai commencé par aller demander à mon ami google. Après avoir consulté beaucoup de page, tout ce qui en ressort, c'est que c'est une erreur qui est du à un header de la requête trop long, et qu'il faut changer la taille max du header dans NGinx, parce que certain navigateur utilisent plus que les 8k configuré par défaut dans Nginx, avec le paramètre large_client_header_buffer
large_client_header_buffers 4 16k;
... Mais ca ne change rien, ce qui n'est pas étonnant vu que mes pages sont ultra minimalistes et n'utilisent aucun cookie.
De plus rien dans les log malgré le passage en mode "info" pour les log d'erreur
Je me tourne donc vers vous, pour savoir si quelqu'un à déjà eu ce problème.
Je vous mets mes fichier de config de nginx:
nginx.conf :
user www-data;
worker_processes auto;
pid /var/run/nginx.pid;
events {
worker_connections 768;
use epoll; # gestionnaire d'évènements epoll (kernel 2.6+)
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/http-access.log combined;
error_log /var/log/nginx/http-error.log info;
sendfile on;
keepalive_timeout 15;
keepalive_disable msie6;
keepalive_requests 100;
tcp_nopush on;
tcp_nodelay off;
server_tokens off;
gzip on;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 16k;
gzip_proxied any;
gzip_vary on;
gzip_disable "msie6";
gzip_types
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
application/vnd.ms-fontobject
font/truetype
font/opentype
image/svg+xml;
include /etc/nginx/sites-enabled/*.conf;
}
/site-enabled/default.conf :
server {
listen 80 default_server;
server_name _;
charset utf-8;
index index.html index.php;
client_max_body_size 10M;
access_log /var/log/nginx/default-access.log combined;
error_log /var/log/nginx/default-error.log info;
error_page 500 502 503 504 /50x.html;
location = /50x.html { root /usr/share/nginx/html; }
location = /favicon.ico {
access_log off;
log_not_found off;
}
## début config site ##
location ^~ / {
root /var/www/html;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
location ^~ /adminer/ {
root /var/www/;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
auth_basic "Restricted Content";
auth_basic_user_file "/etc/nginx/passwd/.htpasswd";
}
}
/site-enable/domain.conf :
server {
listen 80;
server_name sub1.domain.website;
charset utf-8;
index index.html index.php;
client_max_body_size 10M;
access_log /var/log/nginx/home-access.log combined;
error_log /var/log/nginx/home-error.log info;
error_page 500 502 503 504 /50x.html;
location = /50x.html { root /usr/share/nginx/html; }
## début config site ##
location ^~ / {
root /var/www/home;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
}
server {
listen 80;
server_name domain.website www.domain.website;
charset utf-8;
index index.html index.php;
client_max_body_size 10M;
access_log /var/log/nginx/www-access.log combined;
error_log /var/log/nginx/www-error.log info;
error_page 500 502 503 504 /50x.html;
location = /50x.html { root /usr/share/nginx/html; }
## début config site ##
location ^~ / {
root /var/www/html;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
location ^~ /adminer {
root /var/www/adminer;
include /etc/nginx/conf.d/php.conf;
include /etc/nginx/conf.d/cache.conf;
}
}
Merci d'avance et bonne journée.
PS: infos complémentaire, pour installer php7 et toute ses dépendances, j'ai ajouté des dépots à ma distribution de raspbian, est ce que ca aurait pu générer des problèmes du genre avec des "paquets pas pour ma distrib" ?
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free
#deb-src http://repozytorium.mati75.eu/raspbian jessie-backports main contrib non-free
deb http://ftp.fr.debian.org/debian sid main