Apache用户验证

    技术2022-05-18  21

    创建.htaccess文件:

    AuthUserFile /home/<your_username>/webapps/<webapp_name>/.htpasswd AuthName EnterPassword AuthType Basic require valid-user # Hide files starting with a dot (.htaccess and .htpasswd in particular) <Files .*> order allow,deny deny from all </Files> 

     

     

    创建密码:

    htpasswd -c .htpasswd username

    根据提示输入密码。-c 用于创建.htpasswd文件,之后添加密码使用

    htpasswd .htpasswd username 

     

    如果不成功,很有可能需要修改AllowOverride选项为All。AllowOverride可能在/etc/apache2/httpd.conf, /etc/apache2/apache2.conf或/etc/apache2/sites-available/default中找到。

     

     

     

     


    最新回复(0)