N
N
nsrwork2014-05-06 19:00:29
Nginx
nsrwork, 2014-05-06 19:00:29

Custom Nginx error page, how to do?

Below is the config, and everything seems to be correct, but instead of the necessary error pages, an empty page is shown, tell me what's wrong?

server {
    	listen 80;
    	server_name site.ru;
    	server_name_in_redirect off;
  error_log  /var/log/nginx/site.error.log;
    
    	root   /var/www/site.ru/public;

    	location / {
    try_files $uri $uri/ /index.php?q=$uri&$args;
    	}

  location /administrator {
    return 403;
    error_page 403 /403.html;
  }

        location ~* /(images|cache|media|logs|tmp|users)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403.html;
        }

  location ~ /\.ht {
        	deny all;
  }

  location = /favicon.ico {
          log_not_found off;
        	access_log off;
  }

  location = /robots.txt {
          allow all;
          log_not_found off;
        	access_log off;
  }

  location ~ \.php$ {
  		try_files $uri =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
        	fastcgi_pass unix:/var/run/php5-fpm.site.ru.sock;
    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          fastcgi_index index.php;
        	include fastcgi_params;
  }

  location ~* \.(js|css|png|gif)$ {
                expires 7d;
        }

        error_page  404              /404.html;
        location = /404.html {
                root   /var/www/site.ru/errors;
        }

        error_page  403              /403.html;
        location = /403.html {
        	root   /var/www/site.ru/errors;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
    root   /var/www/site.ru/errors;
        }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Zhivotnev, 2014-05-06
@inkvizitor68sl

Does site.ru/403.html show anything?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question