[nginx + php-fpm] problème accès à phpinfo.php (Résolu)
Publié : sam. 25 nov. 2017, 22:28
Bonjour à tous,
Souhaitant peut être installer un serveur web nginx sur une base archlinux, je n'arrive pas a comprendre ce qui pose problème au niveau de ma configuration.
J'ai suivis le tuto qui se trouve ic : https://www.tecmint.com/install-nginx-p ... rch-linux/ et cela fonctionne correctement. Je vous donne la conf du nginx.conf:
J'ai voulu créér mon propre fichier de conf et cela ne fonctionne pas. impossible d’accéder à mon fichier "phpinfo.php" ou à phpMyAdmin. J'ai un "file not found" ou un "403 Access forbidden". je n'arrive vraiment pas a comprendre pourquoi. Du coup lorsque je veux configurer mon propre serveur virtuel cela ne fonctionne pas.
voici mon fichier "nginx.conf"
Dans les 2 cas j'ai bien accés a la page d'accueil nginx...
j'ai vérifier les droits sur le dossier, sur les fichier *.php.
Modification de l'user de lancement de nginx
verification de open_basedir dans "php.ini"
Je n'arrive vraiment pas à voir où je fais une erreur,du coup je me tourne vers vous. Si vous voulez bien m'aider à comprendre mes erreurs ça serait super cool.
Merci par avance pour votre aide. N’hésitez pas si j'ai oublié de donner des informations.
Souhaitant peut être installer un serveur web nginx sur une base archlinux, je n'arrive pas a comprendre ce qui pose problème au niveau de ma configuration.
J'ai suivis le tuto qui se trouve ic : https://www.tecmint.com/install-nginx-p ... rch-linux/ et cela fonctionne correctement. Je vous donne la conf du nginx.conf:
Code : Tout sélectionner
#user html;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
charset koi8-r;
location / {
index index.php index.html index.htm;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location /phpmyadmin {
rewrite ^/* /phpMyAdmin last;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ /\.ht {
deny all;
}
}
}
voici mon fichier "nginx.conf"
Code : Tout sélectionner
#user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
location /phpmyadmin {
rewrite ^/* /phpMyAdmin last;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
# root html;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
j'ai vérifier les droits sur le dossier, sur les fichier *.php
Code : Tout sélectionner
sudo chmod 644 *.php
Modification de l'user de lancement de nginx
Code : Tout sélectionner
user http;
Code : Tout sélectionner
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/:/usr/share/nginx/html/
Merci par avance pour votre aide. N’hésitez pas si j'ai oublié de donner des informations.