安全配置和维护Apache WEB Server(3)

AuthName "会员专区"
AuthType "Basic"
AuthUserFile "/var/tmp/xxx.pw" ----->把password放在网站外
require valid-user 到apache/bin目录,建password档

% ./htpasswd-c/var/tmp/xxx.pw username1----->第一次建档要用参数"-c"

% ./htpasswd/var/tmp/xxx.pw username2

这样就可以保护目录内的内容,进入要用合法的用户.

注:采用了Apache内附的模组。也可以采用在httpd.conf中加入:

options indexes followsymlinks
allowoverride authconfig
order allow,deny
allow from all

(4)Apache服务器访问控制

我们就要看三个配置文件中的第三个文件了,即access.conf文件,它包含一些指令控制允许什么用户访问Apache目录。应该把deny from all设为初始化指令,再使用allow from指令打开访问权限。

1<directory docs="" http="" local="" private="" usr="">
2<limit>   
3order deny,allow   
4deny from all   
5allow from safechina.net   
6</limit>
7</directory>

设置允许来自某个域、IP地址或者IP段的访问。

(5)Apache服务器的密码保护问题

我们再使用.htaccess文件把某个目录的访问权限赋予某个用户。系统管理员需要在httpd.conf或者srm.conf文件中使用AccessFileName指令打开目录的访问控制。如:

AuthName PrivateFiles
AuthType Basic
AuthUserFile /path/to/httpd/users
require Phoenix

htpasswd -c /path/to/httpd/users Phoenix

四,设置Apache服务器的WEB和文件服务器

我们在Apache服务器上存放WEB服务器的文件,供用户访问,并设置/home/ftp/pub目录为文件存放区域,用http://download.XXXX.com/pub/来访问。在防火墙上设置apache反向代理技术,由防火墙代理访问。

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus