나는 내 페이지를 제공하기 위해 php-fpm을 사용하여 간단한 nginx 서버를 실행하고 있습니다.
모든 요청을 503으로 리디렉션한 다음 사용자 지정 오류 페이지를 사용하여 503을 표시하여 유지 관리 모드로 전환하려고 했습니다.
내 문제는 내 구성에 문제가 있으면 nginx가 모든 페이지를 리디렉션하게 한다는 것입니다.포함사용자 정의 503을 정보가 없는 기본 제공 기본값으로 설정하거나 구성을 약간 변경하면(아래 참조) 내 모든 PHP 페이지가 계속 제공됩니다. nginx의 기본값을 사용하는 대신 모든 요청을 유지 관리 페이지로 리디렉션하는 방법을 찾으려고 노력 중입니다.
server {
listen 80 default_server;
# configuration for SSL and other things not pertaining to the question
# ...
root /srv/http;
index index.php index.html index.htm index.nginx-debian.html;
error_page 400 /400.php;
error_page 401 /401.php;
error_page 403 /403.php;
error_page 404 /404.php;
error_page 410 /410.php;
error_page 500 /500.php;
error_page 503 /503.php;
# the method I'm using to enable maintenance involves looking for a file
# putting this right here causes the entire site to be blocked
if (-f $document_root/maintenance.on) {
return 503;
}
location / {
# putting the 503 checker here instead does not stop requests to index.php
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
}
여러 조합을 시도했는데 정말 이해가 안 되네요. 제가 뭘 잘못하고 있나요?