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

王朝厨房·作者佚名  2007-01-02
宽屏版  字体: |||超大  

摘要:暂无

(1)Apache服务器的设置

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

Alias/pub/home/ftp/pub/

更改默认应用程序类型定义如下:

DefaultTypeapplication/octet-stream

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

OptionsIndexes

AllowOverrideAuthConfig

orderallow,deny

allowfromall

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

[root@shopupub]#more.htaccess

AuthNameBranchOfficePublicSoftwareDownloadArea

AuthTypeBasic

AuthUserFile/etc/.usrpasswd

requirevalid-user

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

(2)在防火墙上配置反向代理技术.

在/etc/httpd/conf/httpd.conf中加入 NameVirtualHostxxx.xxx.xxx.xxx

#xxx.xxx.xxx.xxx ----->是防火墙外部在互联网上永久IP地址

servernamewww.XXXX.com

errorlog/var/log/httpd/error_log

transferlog/var/log/httpd/access_log

rewriteengineon

proxyrequestsoff

usecanonicalnameoff

rewriterule^/(.*)$http://xxx.xxx.xx.x/$1Apache服务器的IP地址。

servernamehttp://download.XXXX.com/pub/

errorlog/var/log/httpd/download/error_log

transferlog/var/log/httpd/download/access_log

rewriteengineon

proxyrequestsoff

usecanonicalnameoff

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 所带来的好处。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有