其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
APACHE WEB SERVER管理

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

 
  1. 查看当前UNIX环境下有无运行Apache Web Server
           在终端控制台上运行#ps -ef|grep httpd
            如果运行了,会列出一些包含路径信息的进程;去这个路径下找httpd.conf即可知服务器的配置。
  2. 启动和关闭Apache Web Server
            在运行Apache/bin路径下找到apachectl命令
            #apachectl start
            #apachectl stop
  3. httpd.conf参数介绍:

    1. 知道WEB的管理目录位置
             找到: ServerRoot "/../..."
    2. 知道WEB的根目录位置
             找到: DocumentRoot "/../..."
    3. 知道WEB各虚拟路径的映射
      Alias /icons/ "/opt/www/icons"
      ..........
      ScriptAlias /cgi-bin/ "opt/www/cgi-bin"
      ..........
    4. 支持SSI
      在<Directory " DocumentRoot's directory">
      增加Option +Includes  +ExecCGI
      (其它参数说明:Indexes  容许路径下的目录浏览
                                   FollowSymlinks 容许使用符号连接,连到别处
                     MultiViews 找相似的文件名)
      去掉加注释的以下语句:
      AddType text/html .shtml
      AddHander server-parsed .shtml
      (如果想使htm文件支持SSI,增加以下语句
      AddType text/html .htm
      AddHander server-parsed .htm
      )
    5. 支持CGI
      去掉加注释的以下语句:
      AddHandler cgi-script .pl
      AddHander cgi-script .cgi
    6. 初始的文件名
      DirectoryIndex   index.html
      (如果想增加别的类别文件,只需在这后面增加index.htm或index.php即可)
    7. 性能优化
      MaxKeepAliveRequests 1024
      MaxClient 256
    8. 给WEB路径加密
      创建#htpasswd  -c  加密用户库.db  用户名
      new password:****
      Re-type new passwd:****

      改<Directory " DocumentRoot's directory">
              AllowOverride ALL
            (作用:使每个路径下的.htaccess文件有效)
             </Directory>

      在欲加密的路径下建一个隐含文件.htaccess, 内容如下:
      AuthType Basic
      AuthName Information
      AuthUserFile      /directory/加密用户库.db        // 记录用户名密码的隐含文件路径和名称
      <Limit GET POST PUT>
      require valid-user                     //   容许所有合法用户
      require user                //   容许曾创建的用户名
      </Limit>

    9. 使apache的日志文件里不记录图片文件
            
              找到: 	LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
      		LogFormat "%h %l %u %t \"%r\" %>s %b" common
      		LogFormat "%{Referer}i -> %U" referer
      		LogFormat "%{User-agent}i" agent
      	再后面加上图片文件的类型
      		SetEnvIf Request_URI \.gif$ gif-image
      		SetEnvIf Request_URI \.GIF$ gif-image
      		SetEnvIf Request_URI \.jpg$ gif-image
      		SetEnvIf Request_URI \.JPG$ gif-image
      		SetEnvIf Request_URI \.png$ gif-image
      		SetEnvIf Request_URI \.js$  gif-image		
      		SetEnvIf Request_URI \.bmp$ gif-image
      		SetEnvIf Request_URI \.css$ gif-image
      		SetEnvIf Request_URI \.mid$ gif-image
      		SetEnvIf Request_URI \.swf$ gif-image
      		SetEnvIf Request_URI \.mmf$ gif-image
      		SetEnvIf Request_URI \.wma$ gif-image
      		SetEnvIf Request_URI \.midi$ gif-image
      	记日志时
      		CustomLog /usr/local/apache/logs/access.log combined env=!gif-image		
      	



相关文章

相关软件