Browse Source

Make possible to bypass HTTP Auth for pma and sys vhost with a whitelisted IP (nginx)

Emmanuel Bouthenot 3 years ago
parent
commit
11236da338

+ 7 - 5
roles/webserver/templates/nginx/pma_vhost.j2

@@ -28,15 +28,17 @@ server {
     try_files $uri $uri/ /index.php;
 
 {% if phpmyadmin_http_auth %}
-    auth_basic "Restricted Access";
-    auth_basic_user_file /etc/nginx/auth_admin;
+    location / {
+        auth_basic "Restricted Access";
+        auth_basic_user_file /etc/nginx/auth_admin;
 {% if phpmyadmin_http_whitelist_ip|length > 0 %}
 {% for ip in phpmyadmin_http_whitelist_ip %}
-    allow {{ ip }};
+        allow {{ ip }};
 {% endfor %}
-    deny all;
-    satisfy any;
+        deny all;
+        satisfy any;
 {% endif %}
+    }
 {% endif %}
 
     client_max_body_size 128m;

+ 7 - 5
roles/webserver/templates/nginx/sys_vhost.j2

@@ -28,15 +28,17 @@ server {
     try_files $uri $uri/ /index.php;
 
 {% if phpsyscheck_http_auth %}
-    auth_basic "Restricted Access";
-    auth_basic_user_file /etc/nginx/auth_admin;
+    location / {
+        auth_basic "Restricted Access";
+        auth_basic_user_file /etc/nginx/auth_admin;
 {% if phpsyscheck_http_whitelist_ip|length > 0 %}
 {% for ip in phpsyscheck_http_whitelist_ip %}
-    allow {{ ip }};
+        allow {{ ip }};
 {% endfor %}
-    deny all;
-    satisfy any;
+        deny all;
+        satisfy any;
 {% endif %}
+    }
 {% endif %}
 
     location ~ \.php(/|$) {