|
@@ -37,27 +37,33 @@ wget https://raw.githubusercontent.com/AndiDittrich/HttpErrorPages/master/dist/p
|
|
|
|
|
|
[NGINX](http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page) supports custom error-pages using multiple `error_page` directives.
|
|
|
|
|
|
-File: `default.conf`
|
|
|
+File: [`default.conf`](https://www.nginx.com/resources/wiki/start/topics/examples/full/)
|
|
|
|
|
|
Example - assumes HttpErrorPages are located into `/var/www/ErrorPages/`.
|
|
|
|
|
|
```nginx
|
|
|
-# add one directive for each http status code
|
|
|
-error_page 400 /ErrorPages/HTTP400.html;
|
|
|
-error_page 401 /ErrorPages/HTTP401.html;
|
|
|
-error_page 402 /ErrorPages/HTTP402.html;
|
|
|
-error_page 403 /ErrorPages/HTTP403.html;
|
|
|
-error_page 404 /ErrorPages/HTTP404.html;
|
|
|
-error_page 500 /ErrorPages/HTTP500.html;
|
|
|
-error_page 501 /ErrorPages/HTTP501.html;
|
|
|
-error_page 502 /ErrorPages/HTTP502.html;
|
|
|
-error_page 503 /ErrorPages/HTTP503.html;
|
|
|
-
|
|
|
-# redirect the virtual ErrorPages path the real path
|
|
|
-location /ErrorPages/ {
|
|
|
- alias /var/www/ErrorPages/;
|
|
|
- internal;
|
|
|
-}
|
|
|
+server {
|
|
|
+ listen 80;
|
|
|
+ server_name localhost;
|
|
|
+ root /var/www;
|
|
|
+ index index.html;
|
|
|
+
|
|
|
+ # add one directive for each http status code
|
|
|
+ error_page 400 /ErrorPages/HTTP400.html;
|
|
|
+ error_page 401 /ErrorPages/HTTP401.html;
|
|
|
+ error_page 402 /ErrorPages/HTTP402.html;
|
|
|
+ error_page 403 /ErrorPages/HTTP403.html;
|
|
|
+ error_page 404 /ErrorPages/HTTP404.html;
|
|
|
+ error_page 500 /ErrorPages/HTTP500.html;
|
|
|
+ error_page 501 /ErrorPages/HTTP501.html;
|
|
|
+ error_page 502 /ErrorPages/HTTP502.html;
|
|
|
+ error_page 503 /ErrorPages/HTTP503.html;
|
|
|
+
|
|
|
+ # redirect the virtual ErrorPages path the real path
|
|
|
+ location /ErrorPages/ {
|
|
|
+ alias /var/www/ErrorPages/;
|
|
|
+ internal;
|
|
|
+ }
|
|
|
```
|
|
|
|
|
|
## expressjs Integration ##
|
|
@@ -186,4 +192,4 @@ footer = "Technical Contact: <a href="mailto:x@example.com">x@example.com</a>"
|
|
|
```
|
|
|
|
|
|
## License ##
|
|
|
-HttpErrorsPages is OpenSource and licensed under the Terms of [The MIT License (X11)](http://opensource.org/licenses/MIT) - your're welcome to contribute
|
|
|
+HttpErrorsPages is OpenSource and licensed under the Terms of [The MIT License (X11)](http://opensource.org/licenses/MIT) - your're welcome to contribute
|