Hello! On Sat, Jul 13, 2013 at 02:40:14PM +0100, Michael wrote:
> Hello, I was trying to set a custom error 401 page on my Nginx server > version 1.5.1 using the following methods: > > error_page 401 /401.html > By itself it still displays the default site > > error_page 401 http://example.com/401.html > Goes straight to the custom error page without a chance to authenticate > > error_page 401 /401.html; > location = /401.html > { > root G:/Files; > allow all; > Also goes straight to the error page. > > > > My entire config file: > > worker_processes 1; > > events > { > worker_connections 1024; > } > > http > { > include mime.types; > default_type application/octet-stream; > sendfile on; > > server > { > satisfy any; > allow 192.168.0.0/24; > deny all; > auth_basic "Please login"; > auth_basic_user_file C:\password.txt; > listen 80; > server_name localhost; > root G:/Files; > > location / > { > index index.html index.php /_h5ai/server/php/index.php; > error_page 401 /401.html; > location = /401.html > { > root G:/Files; > } > } > location ~ \.php$ > { > include fastcgi.conf; > fastcgi_pass 127.0.0.1:9000; > } > } > } > > > If anyone has any idea what I'm doing wrong, let me know. Access to /401.html requires authentication, which prevents the error page configured from being returned. Try adding auth_basic off; into location /401.html. -- Maxim Dounin http://nginx.org/en/donation.html _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx