Преглед изворни кода

Merge pull request #3 from Webysther/patch-1

More descriptive sample for nginx
Andi Dittrich пре 7 година
родитељ
комит
48506f7a60
1 измењених фајлова са 29 додато и 19 уклоњено
  1. 29 19
      README.md

+ 29 - 19
README.md

@@ -37,27 +37,37 @@ 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/`.
+Example - assumes HttpErrorPages are located into `/var/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;
+    
+    location / {
+        try_files $uri $uri/ =404;
+        
+        # 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/ErrorPages/;
+        internal;
+    }
 ```
 
 ## expressjs Integration ##
@@ -186,4 +196,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