# Nginx custom error\_page

**URL:** <https://www.ruby-forum.com/t/nginx-custom-error-page/188240>\
**Category:** NGINX\
**Created:** [May 8, 2010, 6:30am UTC](https://www.ruby-forum.com/t/nginx-custom-error-page/188240 "2010-05-08T06:30:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [May 8, 2010, 6:30am UTC](https://www.ruby-forum.com/t/nginx-custom-error-page/188240/1 "2010-05-08T06:30:09Z")

</div>

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](http://pastebin.com/2krFJ3sf)

Posted at Nginx Forum:

> **[nginx custom error\_page](https://forum.nginx.org/read.php?2,84088,84088#msg-84088)**
>
> 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

---

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [May 8, 2010, 7:04am UTC](https://www.ruby-forum.com/t/nginx-custom-error-page/188240/2 "2010-05-08T07:04:41Z")

</div>

Oh and I can’t setup a custom error\_page with error\_page 404 =  
/404.html; It only shows me error\_pages from .php and not from .html.  
-.-

Posted at Nginx Forum:

> **[Re: nginx custom error\_page](https://forum.nginx.org/read.php?2,84088,84096#msg-84096)**
>
> 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

---

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [May 8, 2010, 10:50am UTC](https://www.ruby-forum.com/t/nginx-custom-error-page/188240/3 "2010-05-08T10:50:36Z")

</div>

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](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/(?(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;
    }

```

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![kleinchris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/b2d939/32.png) [@kleinchris](https://www.ruby-forum.com/u/kleinchris)\
**Post date:** [May 8, 2010, 10:55am UTC](https://www.ruby-forum.com/t/nginx-custom-error-page/188240/4 "2010-05-08T10:55:52Z")

</div>

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

> > Here is my config: [http://pastebin.com/2krFJ3sf](http://pastebin.com/2krFJ3sf)
> 
> ```
> include /etc/nginx/fastcgi_params;
> try_files $uri $uri /de/vbseo.php;
> 
> ```

- 

```
        try_files $uri $uri /de/vbseo.php;

```

- 

```
        try_files $uri $uri/ /de/vbseo.php;

```

> ```
> }
> 
> ```

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
