nginx custom error_page

Igor Sysoev igor at sysoev.ru
Sat May 8 12:55:19 MSD 2010


On Sat, May 08, 2010 at 12:50:00PM +0400, Igor Sysoev wrote:

> On Sat, May 08, 2010 at 12:29:29AM -0400, kleinchris wrote:
> 
> > Hello, I wanted to set a custom error_page by setting up:  
> > if (!-e $request_filename) {
> >            rewrite ^/de/(.*)$ /de/vbseo.php last;
> > }
> > if (!-e means if the requestes file don't exists right?! 
> > 
> > nginx server 0.8.32
> > 
> > Here is my config: http://pastebin.com/2krFJ3sf
> 
>         location / {
>             index index.php index.html index.htm;
>         }
> 
>         location ~ ^(?<script>.+\.php)(?<path_info>/.+)?$ {
> 
>             try_files  $script  =404;
> 
>             limit_req zone=antiddos burst=5 nodelay;
> 
>             include /etc/nginx/fastcgi_params;
>             fastcgi_pass unix:/var/fastcgi/www-data.php.socket;
>             fastcgi_param SCRIPT_FILENAME $document_root$script;
>             fastcgi_param PATH_INFO $path_info;
>             fastcgi_param SCRIPT_NAME $script;
>         }
> 
>         location ~ ^/de/(?<sitemap>(urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ {
>             limit_req zone=antiddos burst=5 nodelay;
> 
>             include /etc/nginx/fastcgi_params;
>             fastcgi_pass unix:/var/fastcgi/www-data.php.socket;
>             fastcgi_param SCRIPT_FILENAME
>                         $document_root/de/vbseo_sitemap/vbseo_getsitemap.php;
>             fastcgi_param QUERY_STRING  sitemap=$sitemap;
>             fastcgi_param SCRIPT_NAME   /de/vbseo_sitemap/vbseo_getsitemap.php;
>         }
> 
>         location /de/ {
>             index index.php index.html index.htm;
> 
>             try_files  $uri  $uri  /de/vbseo.php;

-             try_files  $uri  $uri  /de/vbseo.php;
+             try_files  $uri  $uri/  /de/vbseo.php;

>         }


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list