nginx 웹 서버에 phpmyadmin을 설치하려고 합니다. 문제없이 phpmyadmin을 설치했습니다. 나는 그것을 위해 하위 도메인을 만들었습니다. 보안상의 이유로 하위 도메인을 "phpmyadmin"이라고 부르지 않고 다른 이름을 사용했습니다. 그런 다음 내 하위 도메인에 이 구성을 사용했습니다.
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;
}
}
그런 다음 이렇게 활성화했습니다.
/etc/nginx/sites-available/myphpmyadminsubdomain /etc/nginx/sites-enabled/myphpmyadminsubdomain
nginx를 다시 시작하고 myphpmyadminsubdomain.domain.com으로 이동하면 nginx 404 Not Found 오류가 발생합니다.
내가 도대체 뭘 잘못하고있는 겁니까?
답변1
이것이 내 구성입니다.
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;
}
}
루트는 다음으로 변경되어야 하며 /usr/share/phpmyadmin
적절 fastcgi_params
하게 변경되어야 합니다.
답변2
일반적으로 경로 문제입니다. nginx.conf 세트에서
fastcgi_param SCRIPT_FILENAME /absolute/path/to/server/root$fastcgi_script_name;
경로의 마지막 디렉토리 뒤에는 슬래시가 없습니다. 둘째, 소켓이나 로컬 URL에 fastcgi_pass를 수행합니다.
php-cgi를 chroot하고 있습니까? 그런 다음 모든 경로는 해당 chroot에 상대적이어야 합니다.