다음 서버 블록이 있습니다.
server {
listen 80;
server_name utsav-dev.domain.org;
root /var/www/domain-utsav-dev/web;
access_log /var/log/nginx/domain-utsav-dev-access.log;
error_log /var/log/nginx/domain-utsav-dev-error.log error;
error_page 404 = /var/www/domain/web/50x.html;
set $thttps $https;
set $tscheme $scheme;
if ($http_x_forwarded_proto = http) {
set $thttps off;
set $tscheme "http";
}
if ($http_x_forwarded_proto = HTTP) {
set $thttps off;
set $tscheme "http";
}
index app.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /app.php/$1;
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 86400;
access_log off;
add_header Cache-Control "public";
}
location ~ \.php {
fastcgi_index app.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param APPLICATION "www";
fastcgi_param APPLICATION_ENV "dev";
fastcgi_param PDFLIBLICENSEFILE "/etc/php5/fpm/pdflib.license";
fastcgi_param HTTPS $thttps;
}
location ~ /\.ht {
deny all;
}
chunked_transfer_encoding off;
}
이제 페이지가 발견되지 않는 경우 스크립트에 따라, nginx를 내부적으로 50x.html로 리디렉션해야하지만 열려고하면 http://utsav-dev.domain.org/blah.html 그것은 나를 오류가 있습니다 "파일을 찾을 수 없습니다"를 보다 내가 기대했던 사용자 정의 404 페이지. 왜?
fastcgi_intercept_errors on;
fastcgi 위치 에 설정 하십시오.
fastcgi_intercept_errors on | off; Determines whether FastCGI server responses with codes greater than or equal to 300 should be passed to a client or be redirected to nginx for processing with the error_page directive.
방문 할 때 http://utsav-dev.domain.org/blah.html
:
try_files
. @rewrite 위치를 누르십시오.당신은 일 fastcgi_intercept_errors on;
하도록 설정해야 error_page
합니다
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다