首 页 ┆ 源码下载 ┆ IT学院 ┆ 字体下载 ┆ 模板下载 ┆ 源码发布 ┆ 广告合作 ┆ 网站地图 ┆ 虚拟主机 ┆ 中文域名
► 设为首页
► 加入收藏
► 联系我们
源码下载 >> ASP源码 | PHP源码 | ASP.net源码 | JSP源码 | CGI源码 | VC/C++源码 | VB源码 | Delphi源码 | Flash源码
文章学院 >> 网络编程 | 网页设计 | 图形图象 | 数据库 | 服务器 | 网络媒体 | 网络安全 | 操作系统 | 办公软件 | 软件开发 | 黑客知识
字体下载 >> 精制字体 | 非英字体 | 艺术字体 | 著名字体 | 哥特式 | 简单字体 | 手写体 | 节假日 | 图案字体 | 精度像素 | 中文字体
模板下载 >> 企业门户 | 数码网络 | 休闲娱乐 | 影视音乐 | 旅游名胜 | 文化艺术 | 电子商务 | 个性展示 | 登陆导航 | Flash模板
►►您当前的位置:源码园 → IT学院 → 网络安全 → 安全防范 → 文章内容

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

作者:佚名  来源:不详  发布时间:2007-2-8 19:54:00
  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指令打开访问权限。

  <directory /usr/local/http/docs/private>
  <limit>
  order deny,allow
  deny from all
  allow from safechina.net
  </limit>
  </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反向代理技术,由防火墙代理访问。[page]

(1)Apache服务器的设置

  apache服务器采用默认配置。主目录为/home/httpd/html,主机域名为Phoenix.XXXX.com,且别名到www.XXXX.com中,并且设置srm.conf加一行别名定义如下: 
  Alias/pub/home/ftp/pub/ 

  更改默认应用程序类型定义如下: 
 
  DefaultType application/octet-stream 

  最后在/etc/httpd/conf/access.conf中增加一项定义 

  Options Indexes 
  AllowOverride AuthConfig 
  order allow,deny 
  allow from all 

  注:Options Indexes允许在找不到index.html文件的情况下允许列出目录/文件列表。AllowOverride AuthConfig允许做基本的用户名和口令验证。这样的话,需要在/home/ftp/pub目录下放入.htaccess,内容如下: 

  [root@shopu pub]# more .htaccess 
  AuthName Branch Office Public Software Download Area 
  AuthType Basic 
  AuthUserFile /etc/.usrpasswd 
  require valid-user 

  用# htpasswd -c /etc/.usrpasswd user1  分别创建不同的允许访问/pub下文件服务的外部用户名和口令。 

  (2)在防火墙上配置反向代理技术. 
 
  在/etc/httpd/conf/httpd.conf中加入 NameVirtualHost xxx.xxx.xxx.xxx
  # xxx.xxx.xxx.xxx ----->是防火墙外部在互联网上永久IP地址 
  servername www.XXXX.com 
  errorlog /var/log/httpd/error_log 
  transferlog /var/log/httpd/access_log 
  rewriteengine on 
  proxyrequests off 
  usecanonicalname off 
  rewriterule ^/(.*)$ http://xxx.xxx.xx.x/$1 Apache服务器的IP地址。

  servername http://download.XXXX.com/pub/
  errorlog /var/log/httpd/download/error_log 
  transferlog /var/log/httpd/download/access_log 
  rewriteengine on 
  proxyrequests off 
  usecanonicalname off 
  rewriterule^/(.*)$http://xxx.xxx.xx.x/$1 同上Apache服务器的IP地址。

  设置防火墙上的DNS,让download.XXXX.com和www.XXXX.com都指向防火墙的外部网地址xxx.xxx.xxx.xxx。用http://www.XXXX.com访问主页,用http://download.XXXX.com/pub/访问公共文件的下载区。

  注:还需要在apache服务器主机上建立目录/var/log/httpd/download/,否则会出错。另外,也可以设置防火墙主机上的/home/httpd/html/index.html的属性为750来阻止访问,这是防外部用户能访问到防火墙上的Apache服务器的http://www.XXXX.com中。

  总结:Apache Server是一个非常优秀,非常棒的服务器,只要你正确配置和维护好Apache服务器,你就会感受到Apache Server 所带来的好处。

 


[] [返回上一页] [打 印]
  • 上一篇文章:安全配置和维护Apache WEB Server (上)
  • 下一篇文章:安全性与IIS (一)

  • 相关文章:
  • Windows防火墙安全配置
  • 防火墙与路由器的安全配置
  • 安全配置网吧电影服务器
  • 介绍Sendmail服务器安全配置技巧
  • Win2K/XP 下巧拒强行关机
  • Windows 2000/XP 下巧拒强行关机
  • 安全配置Windows2000服务器
  • Linux 下文件的压缩、打包与解开
  • 浅谈linux操作系统的优化及安全配置
  • Linux 下采用软件实现RAID
  • WIN2003服务器端安全配置的一点简单经验
  • 感受Windows 2003 SP1安全配置向导功能
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 源码发布
Copyright © 2003-2009 Ymyasp.Com. All Rights Reserved .
备案序号:粤ICP备07029071号