Ich versuche, phpmyadmin auf meinem Nginx-Webserver zu installieren. Die Installation von phpmyadmin verlief problemlos. Ich habe eine Subdomain dafür erstellt. Aus Sicherheitsgründen habe ich meine Subdomain nicht „phpmyadmin“ genannt, sondern einen anderen Namen verwendet. Dann habe ich diese Konfiguration für meine Subdomain verwendet
server {
listen 80;
server_name myphpmyadminsubdomain.domain.com;
access_log off;
error_log /srv/www/myphpmyadminsubdomain/error.log;
location / {
root /usr/share/phpmyadmin;
index index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_intercept_errors on;
fastcgi_pass php;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}
Dann habe ich es wie folgt aktiviert;
/etc/nginx/sites-available/myphpmyadminsubdomain /etc/nginx/sites-enabled/myphpmyadminsubdomain
Ich habe nginx neu gestartet und bin zu myphpmyadminsubdomain.domain.com gegangen. Dort erhalte ich den nginx-Fehler „404 Nicht gefunden“.
Was mache ich falsch?
Antwort1
Das ist meine Konfiguration
server {
listen 80; ## listen for ipv4
server_name pma.example.com;
access_log /var/log/nginx/pma.access.log;
error_log /var/log/nginx/pma.error.log;
root /server/phpmyadmin/phpMyAdmin-3.4.2-all-languages;
location / {
index index.php index.html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_intercept_errors off;
fastcgi_pass php;
}
}
Die Wurzel sollte in geändert werden /usr/share/phpmyadmin
und die fastcgi_params
sollte entsprechend geändert werden.
Antwort2
Es handelt sich normalerweise um ein Pfadproblem. In nginx.conf setzen
fastcgi_param SCRIPT_FILENAME /absolute/path/to/server/root$fastcgi_script_name;
Beachten Sie, dass nach dem letzten Verzeichnis im Pfad kein Schrägstrich steht. Zweitens: Fastcgi_pass entweder zu einem Socket oder einer lokalen URL.
Chrooten Sie Ihr PHP-CGI? Dann müssen alle Pfade relativ zu diesem Chroot sein.