[英]How can I make (the most) basic .htaccess file to password protect a website
为了保护我的网站,我要做的是在/var/www/html/
目录中创建此.htaccess
文件
AuthType Basic
AuthName "One does not simply"
AuthUserFile /home/user/.htpasswd
Require valid-user
然后我通过运行命令htpasswd -c /home/blah/.htpasswd alex
在主目录中创建了一个.htpasswd
但这不起作用。 实际上,当我访问该网站时,我没有任何身份验证弹出窗口或任何东西。
我正在使用全新安装的Ubuntu 18.04在完全干净的 VPS上执行此操作,并且仅安装了apache2
如果您真的想使其简单:
AuthType Basic
AuthName "My page is password protected!"
AuthUserFile /home/user/.htpasswd
Require valid-user
创建一个.htpasswd文件,为用户名和密码添加以下内容:
karrot:mypassword
确保在正确的文件夹中添加.htpasswd。
希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.