404 error when adding htpasswd auth (nginx)

Hi there,



I tried to secure my mautic installation by adding a htpasswd on its login page.



I’m using Nginx, so the configuration setting has been placed as following:

Code:
location /s/login { auth_basic "Restricted!"; auth_basic_user_file /path/to/.htpasswd; }

It works. When entering my Mautic site it prompts me with the credentials popup. But when I enter the credentials I see a 404 page.

And looking on the error.log this is the statement:
"/var/www/'sitedomain.com'/htdocs/s/login" failed (2: No such file or directory)...

If I remove the location and htaccess location from the config file it works fine.

Does anyone have a clue here? It seems looking for content inside the '...htdocs/s/login' which doesn't seem right. But I'm not sure where to point to the correct location.

Hi there,

I tried to secure my mautic installation by adding a htpasswd on its login page.

I’m using Nginx, so the configuration setting has been placed as following:

location /s/login {
 auth_basic "Restricted!";
 auth_basic_user_file /path/to/.htpasswd;
}

It works. When entering my Mautic site it prompts me with the credentials popup. But when I enter the credentials I see a 404 page.

And looking on the error.log this is the statement:
“/var/www/‘sitedomain.com’/htdocs/s/login” failed (2: No such file or directory)…

If I remove the location and htaccess location from the config file it works fine.

Does anyone have a clue here? It seems looking for content inside the ‘…htdocs/s/login’ which doesn’t seem right. But I’m not sure where to point to the correct location.

I try that method a few years ago and using that method i notice yes you secure the /s/login page but also i notice some problem that affect the use of Mautic (Leads, Landing Pages, Email ) so check that all is working after doing that.

PD: I not longer use that method to secure Mautic.

Thanks, ninjoan!

I’d like to enhance the security of my login page to avoid password cracking attempts. But I indeed hope it doesn’t prevent the system to work as it should.

Does anyone on the forum has any other experience/solution to share?

Regards,

Marcos Saturno