G
G
Grebenshikov2014-09-20 11:06:36
PHP
Grebenshikov, 2014-09-20 11:06:36

How to handle 500 php-fpm error from nginx?

Actually there is an nginx config with the following content:

server {
  listen 80;
  server_name example.com;
  set $path "/var/www";
  
  root $path/public;
  index index.html index.htm;
    
       
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root $path/system;
  }

  location = / {
    try_files @site @site;
  }
  location / {
    try_files $uri $uri/ @site;
  }

  location @site {
    fastcgi_pass unix:/var/run/php5-fpm.sock;   
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME $path/site/index.php;
  }
}

Is it possible to implement displaying 50x.html every time php-fpm returns a 5xx error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Senkevich, 2014-09-20
@Grebenshikov

You have exactly this and it is written in the line:
error_page 500 502 503 504 /50x.html;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question