From f084b9028217e31bb50d8aae426a9be3dccacfda Mon Sep 17 00:00:00 2001 From: aptalca Date: Tue, 6 Mar 2018 13:44:17 -0500 Subject: [PATCH] fix if statement logic --- root/defaults/default | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/root/defaults/default b/root/defaults/default index 68b3e53..fcf9351 100644 --- a/root/defaults/default +++ b/root/defaults/default @@ -15,21 +15,20 @@ server { client_max_body_size 0; - if (-f /config/nginx/.htpasswd) { - return 599; - } + error_page 599 = @noauth; - location / { - try_files $uri $uri/ /index.php?$args; - } - - error_page 599 = @htpasswd; - - location @htpasswd { - auth_basic "Restricted"; - auth_basic_user_file /config/nginx/.htpasswd; - try_files $uri $uri/ /index.php?$args; - } + location / { + if (!-f /config/nginx/.htpasswd) { + return 599; + } + auth_basic "Restricted"; + auth_basic_user_file /config/nginx/.htpasswd; + try_files $uri $uri/ /index.php?$args; + } + + location @noauth { + try_files $uri $uri/ /index.php?$args; + } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$;