Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_core_module.xml @ 679:9888364847b7
Documented status codes in the error_page directive.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 13 Sep 2012 08:02:40 +0000 |
parents | c48c0936b4df |
children | a4648185190a |
comparison
equal
deleted
inserted
replaced
678:90c27a37f4ed | 679:9888364847b7 |
---|---|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | 8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
9 | 9 |
10 <module name="Module ngx_http_core_module" | 10 <module name="Module ngx_http_core_module" |
11 link="/en/docs/http/ngx_http_core_module.html" | 11 link="/en/docs/http/ngx_http_core_module.html" |
12 lang="en" | 12 lang="en" |
13 rev="4"> | 13 rev="5"> |
14 | 14 |
15 <section id="directives" name="Directives"> | 15 <section id="directives" name="Directives"> |
16 | 16 |
17 <directive name="aio"> | 17 <directive name="aio"> |
18 <syntax> | 18 <syntax> |
578 These directives are inherited from the previous level if and | 578 These directives are inherited from the previous level if and |
579 only if there are no | 579 only if there are no |
580 <literal>error_page</literal> | 580 <literal>error_page</literal> |
581 directives on | 581 directives on |
582 the current level. | 582 the current level. |
583 A URI value can contain variables. | 583 A <literal>uri</literal> value can contain variables. |
584 </para> | 584 </para> |
585 | 585 |
586 <para> | 586 <para> |
587 Example: | 587 Example: |
588 <example> | 588 <example> |
589 error_page 404 /404.html; | 589 error_page 404 /404.html; |
590 error_page 502 503 504 /50x.html; | 590 error_page 500 502 503 504 /50x.html; |
591 error_page 403 http://example.com/forbidden.html; | 591 </example> |
592 </example> | 592 </para> |
593 </para> | 593 |
594 | 594 <para> |
595 <para> | 595 Furthermore, it is possible to change the response code to another |
596 Furthermore, it is possible to change the response code to another, for example: | 596 using the “<literal>=code</literal>” syntax, for example: |
597 <example> | 597 <example> |
598 error_page 404 =200 /empty.gif; | 598 error_page 404 =200 /empty.gif; |
599 </example> | 599 </example> |
600 </para> | 600 </para> |
601 | 601 |
607 error_page 404 = /404.php; | 607 error_page 404 = /404.php; |
608 </example> | 608 </example> |
609 </para> | 609 </para> |
610 | 610 |
611 <para> | 611 <para> |
612 If there is no need to change URI during redirection it is possible to redirect | 612 It is also possible to use redirects for error processing: |
613 error processing into a named location: | 613 <example> |
614 error_page 403 http://example.com/forbidden.html; | |
615 error_page 404 =301 http://example.com/notfound.html; | |
616 </example> | |
617 In this case, the response code 302 is returned to the client. | |
618 It can only be changed to one of the redirect status | |
619 codes (301, 302, 303 and 307). | |
620 </para> | |
621 | |
622 <para> | |
623 If there is no need to change URI during internal redirection it is | |
624 possible to pass error processing into a named location: | |
614 <example> | 625 <example> |
615 location / { | 626 location / { |
616 error_page 404 = @fallback; | 627 error_page 404 = @fallback; |
617 } | 628 } |
618 | 629 |
619 location @fallback { | 630 location @fallback { |
620 proxy_pass http://backend; | 631 proxy_pass http://backend; |
621 } | 632 } |
622 </example> | 633 </example> |
634 </para> | |
635 | |
636 <para> | |
637 <note> | |
638 If the <literal>uri</literal> processing led to an error, | |
639 the HTTP status code indicating last occurred problem | |
640 will be returned. | |
641 </note> | |
623 </para> | 642 </para> |
624 | 643 |
625 </directive> | 644 </directive> |
626 | 645 |
627 | 646 |