Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_core_module.xml @ 1826:da6a3e401b26
Slightly reformatted the error_page description.
Information about directives inheritance was moved to the end.
Blocks describing various syntaxes of the "uri" argument were
put in the following order:
- internal redirect to the specified /uri;
- internal redirect to a named location;
- URL redirection.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 24 Oct 2016 11:57:46 +0300 |
parents | ae46e57cecba |
children | 64e2b8c5200d |
comparison
equal
deleted
inserted
replaced
1825:56b6244ddadb | 1826:da6a3e401b26 |
---|---|
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="61"> | 13 rev="62"> |
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> |
609 <context>location</context> | 609 <context>location</context> |
610 <context>if in location</context> | 610 <context>if in location</context> |
611 | 611 |
612 <para> | 612 <para> |
613 Defines the URI that will be shown for the specified errors. | 613 Defines the URI that will be shown for the specified errors. |
614 <literal>error_page</literal> directives are inherited from the previous | 614 A <value>uri</value> value can contain variables. |
615 level only if there are no <literal>error_page</literal> | |
616 directives defined on the current level. | |
617 A <literal>uri</literal> value can contain variables. | |
618 </para> | 615 </para> |
619 | 616 |
620 <para> | 617 <para> |
621 Example: | 618 Example: |
622 <example> | 619 <example> |
642 error_page 404 = /404.php; | 639 error_page 404 = /404.php; |
643 </example> | 640 </example> |
644 </para> | 641 </para> |
645 | 642 |
646 <para> | 643 <para> |
647 It is also possible to use redirects for error processing: | 644 If there is no need to change URI during internal redirection it is |
645 possible to pass error processing into a named location: | |
646 <example> | |
647 location / { | |
648 error_page 404 = @fallback; | |
649 } | |
650 | |
651 location @fallback { | |
652 proxy_pass http://backend; | |
653 } | |
654 </example> | |
655 </para> | |
656 | |
657 <para> | |
658 <note> | |
659 If <value>uri</value> processing leads to an error, | |
660 the status code of the last occurred error is returned to the client. | |
661 </note> | |
662 </para> | |
663 | |
664 <para> | |
665 It is also possible to use URL redirects for error processing: | |
648 <example> | 666 <example> |
649 error_page 403 http://example.com/forbidden.html; | 667 error_page 403 http://example.com/forbidden.html; |
650 error_page 404 =301 http://example.com/notfound.html; | 668 error_page 404 =301 http://example.com/notfound.html; |
651 </example> | 669 </example> |
652 In this case, by default, the response code 302 is returned to the client. | 670 In this case, by default, the response code 302 is returned to the client. |
653 It can only be changed to one of the redirect status | 671 It can only be changed to one of the redirect status |
654 codes (301, 302, 303, and 307). | 672 codes (301, 302, 303, and 307). |
655 </para> | 673 </para> |
656 | 674 |
657 <para> | 675 <para> |
658 If there is no need to change URI during internal redirection it is | 676 These directives are inherited from the previous level if and |
659 possible to pass error processing into a named location: | 677 only if there are no |
660 <example> | 678 <literal>error_page</literal> |
661 location / { | 679 directives defined on the current level. |
662 error_page 404 = @fallback; | |
663 } | |
664 | |
665 location @fallback { | |
666 proxy_pass http://backend; | |
667 } | |
668 </example> | |
669 </para> | |
670 | |
671 <para> | |
672 <note> | |
673 If <literal>uri</literal> processing leads to an error, | |
674 the status code of the last occurred error is returned to the client. | |
675 </note> | |
676 </para> | 680 </para> |
677 | 681 |
678 </directive> | 682 </directive> |
679 | 683 |
680 | 684 |