nginx : defaut de redirection
Bonjour,
J'utilise nginx depuis peu, et je rencontre quelques problèmes sur un serveur.
j'ai install phpmyadmin et phppgadmin. (le serveur héberge aussi seafile et baikal sans problèmes)
Mes redirections DNS sont faites chez ovh. pg.domaine.com et my.domaine.com pointent vers l'ip de mon VPS.
Ensuite, voici mes fichiers conf dans nginx :
default :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.html;
}
location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}
}
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/certs/cacert.pem; # path to your cacert.pem
ssl_certificate_key /etc/nginx/certs/privkey.pem; # path to your privkey.pem
server_name _;
root /usr/share/nginx/www;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
} |
le fichier phppgadmin
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| server {
listen 80;
server_name pg.domaine.com;
rewrite ^/(.*) https://$server_name/$1 permanent; # force redirect http to https
}
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/certs/cacert.pem; # path to your cacert.pem
ssl_certificate_key /etc/nginx/certs/privkey.pem; # path to your privkey.pem
server_name pg.domaine.com;
location / {
root /usr/share/phppgadmin/;
index index.php index.html index.htm;
location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phppgadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
} |
et phpmysql :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| server {
listen 80;
server_name my.domaine.com;
rewrite ^/(.*) https://$server_name/$1 permanent; # force redirect http to https
}
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/certs/cacert.pem; # path to your cacert.pem
ssl_certificate_key /etc/nginx/certs/privkey.pem; # path to your privkey.pem
server_name my.domaine.com;
location / {
root /usr/share/phpmyadmin/;
index index.php index.html index.htm;
location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
} |
Le problème est que domaine.com pointe sur phppgadmin, pg.domaine.com et my.domaine.com pointent tous deux vers phpmyadmin
Merci d'avance pour votre aide