It is not possible to set custom error page. For example /usr/share/nginx/404.html contains "test":
server { error_page 404 /404.html; if ($request_method = "GET") return 404; } location / { proxy_pass http://localhost:8080; } location /404.html { /usr/share/nginx/404.html; } } curl -v 127.0.0.1 * About to connect() to 127.0.0.1 port 80 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: 127.0.0.1 > Accept: */* > < HTTP/1.1 404 Not Found < Server: nginx < Date: Tue, 26 Aug 2014 08:45:26 GMT < Content-Type: text/html < Content-Length: 162 < Connection: keep-alive < Keep-Alive: timeout=20 < <html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>nginx</center> </body> </html> * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 But if I'll make rewrite rule: server { error_page 404 /404.html; if ($request_method = "GET") rewrite ^ /404.html last; } location / { proxy_pass http://localhost:8080; } location /404.html { /usr/share/nginx/404.html; } } I'll get: curl -v 127.0.0.1 * About to connect() to 127.0.0.1 port 80 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 80 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: 127.0.0.1 > Accept: */* > < HTTP/1.1 200 OK < Server: nginx < Date: Tue, 26 Aug 2014 08:46:25 GMT < Content-Type: text/html < Content-Length: 5 < Last-Modified: Tue, 26 Aug 2014 08:42:47 GMT < Connection: keep-alive < Keep-Alive: timeout=20 < ETag: "53fc4887-5" < Accept-Ranges: bytes < test * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 But I'll get 200 OK. Is it possible to get cutsom 404 error page with 404 error code using "return 404" directive? Posted at Nginx Forum: http://forum.nginx.org/read.php?2,252825,252825#msg-252825 _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx