多个vhost需要添加vhost web验证
批量添加vhost配置文件
[root@test extra]# sed '/Options/r th.txt' httpd-vhosts32.conf |sed 's/AllowOverride All//g'|sed 's/Order allow,deny//g'|sed 's/Allow from all//g' >>tmp.conf
th.txt 文件内容:
AuthName "tel me you passwd"
AllowOverride AuthConfig
AuthType Basic
AuthUserFile /usr/local/apache/passwd/.htpasswd
require valid-user
批量添加vhost配置文件
[root@test extra]# sed '/Options/r th.txt' httpd-vhosts32.conf |sed 's/AllowOverride All//g'|sed 's/Order allow,deny//g'|sed 's/Allow from all//g' >>tmp.conf
th.txt 文件内容:
AuthName "tel me you passwd"
AllowOverride AuthConfig
AuthType Basic
AuthUserFile /usr/local/apache/passwd/.htpasswd
require valid-user
最后把tmp.conf mv成vhost名称即可。
本文转自 liang3391 51CTO博客,原文链接:http://blog.51cto.com/liang3391/456561