How to password protect a directory on Caddy 2. As for example, if I have to password protect phpMyAdmin located at:
/var/www/html/phpMyAdmin
Whereas, my website root directory is located at:
/var/www/html/mywebsite
Thanks!
How to password protect a directory on Caddy 2. As for example, if I have to password protect phpMyAdmin located at:
/var/www/html/phpMyAdmin
Whereas, my website root directory is located at:
/var/www/html/mywebsite
Thanks!
The basicauth
directive is made exactly for that!
Yeh I seen that but I was not able to make it work. Can I get a working example please.
There are examples right at the bottom of that documentation page.
What have you tried? What’s your current Caddyfile?
Bob can access protected /secret/* resources with password “hiccup”. Thats fine!
But, Where there is hiccup in:
basicauth /secret/* {
Bob JDJhJDEwJEVCNmdaNEg2Ti5iejRMYkF3MFZhZ3VtV3E1SzBWZEZ5Q3VWc0tzOEJwZE9TaFlZdEVkZDhX
}
How to generate that encrypted password:
JDJhJDEwJEVCNmdaNEg2Ti5iejRMYkF3MFZhZ3VtV3E1SzBWZEZ5Q3VWc0tzOEJwZE9TaFlZdEVkZDhX
and use. That I didn’t understand!
I mean what I have to command on SSH? Like:
caddy hash-password hiccup
What’s the right one?
Okay got that:
caddy hash-password --plaintext hiccup --algorithm scrypt --salt base-64
The documentation for caddy hash-password ist here:
https://caddyserver.com/docs/command-line#caddy-hash-password
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.