新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 网络学院 > 服务器 > web服务器 > 正文:Apache服务器配置安全规范及缺陷

Apache服务器配置安全规范及缺陷

新客网 XKER.COM 2007-12-19 来源:赛迪网 收藏本文

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

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

(1)Apache服务器的设置 

Apache服务器采用默认配置。主目录为/home/httpd/html,主机域名为Phoenix.your.com, 且别名到www.your.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@ 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.your.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.your.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.your.com和www.your.com 都指向防火墙的外部网地址xxx.xxx.xxx.xxx。

用http://www.your.com访问主页,用http://download.your.com/pub/访问公共文件的下载区。

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

总结:Apache Server是一个非常优秀,非常棒的服务器,只要你正确配置和维护好Apache服务器,你就会感受到Apache Server 所带来的好处,同样希望你能够通过阅读本文达到理论和实践双丰收的目的。

共4页: 上一页 [1] [2] [3] [4] 下一页
收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
阅读排行
随机推荐
实用信息推荐