Advanced HTTP Basic Auth query with determine IP address
January 01, 2019 03:01PM
Hello forum user, I have a page that can only be reached via IP address. Now I want to make this page open from the outside. But then an Auth _ Basic query is to come up.


I entered the following line in the domain configuration.

location / {
if ($remote_addr != XXX.XXX.XXX.XX)
{
try_files $uri $uri/ =404;
auth_basic "Externe Zugriffskontrolle";
auth_basic_user_file /.../...../........../........../.htpasswd;
}
}


Unfortunately, I keep getting the error message: "nginx: [emerg] " try _ files "directive is not allowed here in ... " Without a query it works. But then the query is always there. Can anyone help me?

Thanks in advance ...
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 122
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready