Apache 访问权限设置

vim /usr/local/apache2_55/conf/extra/httpd-vhosts.conf


    #ServerAdmin [email protected]
    DocumentRoot "/www/www.test.com"
    ServerName www.test.com
    
        Options All
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    

    ErrorLog "/logs/www.test.com-error_log"
    CustomLog "/logs/www.test.com-access_log" common

vim /www/www.test.com/.htaccess

AuthName "wiki share web"
AuthType Basic
AuthUserFile /www/www.test.com/.htpasswd
require valid-user
# 创建用户,第一次创建用户使用-c,后面就可以避免
htpasswd -c /www/www.test.com/.htpasswd username
密码:psw

# 修改密码
htpasswd -m .htpasswd frank

# 重启apache
httpd -k restart

你可能感兴趣的:(Apache 访问权限设置)