apache虚拟目录
时间:2006-11-05 来源:0217
常用配置文件:/var/www/html
/etc/httpd/conf/httpd.con
在/etc/httpd/conf/httpd.con
下设置server Name 设置为本地:127.0.0.1:80
##ServerName 127.0.0.1:80
Document Root: 后写正确的路劲
listen 80 监听本机80端口
listen 12.34.56.78:80只监听指定IP端口
apache 虚拟目录
vi /etc/httpd/conf.d/v_dir.conf #v_dir.conf 自已生成的
Alias /mp4/ "/mylovemusic/" #mp4:是虚拟目录的名称,/mylovemusic/是真正目录
<Directory "/mylovemusic/">
Options Indexes MultiViews
AllowOverride AuthConfig #为None 时为不用有身份验证
AuthName "please input your name and passwd"
AuthType Basic
AuthUserFile /mylovemusic/.htpasswd #验证用户名和密码的配置文件
AuthGroupFile /mylovemusic/.htgroup #验证用户组的配置文件
Require group gdlcgroup #许可GDLCGROUP用户组登陆
Require user gdlc #许可gdlc用户登陆
Allow from 10.0.2.0/24 #许可10.0.2.0/24网内登陆 为all 时是许可所有
</Directory>
1,创建验证用户
htpasswd -c /var/www/html/.htpasswd 用户名
创建验证用户组
cd /var/www/html/
vi .htgroup
gdlcgroup; jake gdlc
2,在/var/www/html/ 下创建 .htaccess认证文件
AuthName "please input name&passwd"
AuthType Basic
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /var/www/html/.htgroup
Require group gdlcgroup #接收组内所有信息
Require user jake #接收jake这个用户
重启服务:service httpd restart
/etc/httpd/conf/httpd.con
在/etc/httpd/conf/httpd.con
下设置server Name 设置为本地:127.0.0.1:80
##ServerName 127.0.0.1:80
Document Root: 后写正确的路劲
listen 80 监听本机80端口
listen 12.34.56.78:80只监听指定IP端口
apache 虚拟目录
vi /etc/httpd/conf.d/v_dir.conf #v_dir.conf 自已生成的
Alias /mp4/ "/mylovemusic/" #mp4:是虚拟目录的名称,/mylovemusic/是真正目录
<Directory "/mylovemusic/">
Options Indexes MultiViews
AllowOverride AuthConfig #为None 时为不用有身份验证
AuthName "please input your name and passwd"
AuthType Basic
AuthUserFile /mylovemusic/.htpasswd #验证用户名和密码的配置文件
AuthGroupFile /mylovemusic/.htgroup #验证用户组的配置文件
Require group gdlcgroup #许可GDLCGROUP用户组登陆
Require user gdlc #许可gdlc用户登陆
Allow from 10.0.2.0/24 #许可10.0.2.0/24网内登陆 为all 时是许可所有
</Directory>
1,创建验证用户
htpasswd -c /var/www/html/.htpasswd 用户名
创建验证用户组
cd /var/www/html/
vi .htgroup
gdlcgroup; jake gdlc
2,在/var/www/html/ 下创建 .htaccess认证文件
AuthName "please input name&passwd"
AuthType Basic
AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /var/www/html/.htgroup
Require group gdlcgroup #接收组内所有信息
Require user jake #接收jake这个用户
重启服务:service httpd restart
相关阅读 更多 +
排行榜 更多 +