手机版
你好,游客 登录 注册
背景:
阅读新闻

Apache优化配置详解

[日期:2012-07-12] 来源:Linux社区  作者:mymbk [字体:大 中 小]

##设置子进程的用户和组
<IfModule !mpm_netware_module>
User daemon
Group daemon
</IfModule>
##设置默认WEB文档根目录
DocumentRoot "/usr/local/apache-2.2.6/htdocs"
##设置WEB文档根目录的默认属性
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
##设置DocumentRoot指定目录的属性
<Directory "/usr/local/apache-2.2.6/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
##设置默认目录资源列表文件
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
##拒绝对.ht开头文件的访问,以保护.htaccess文件
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
##指定错误日志文件
ErrorLog logs/error_log
##指定记录到错误日志的消息级别
LogLevel warn
<IfModule log_config_module>
##定义访问日志的格式
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
##指定访问日志及使用的格式
    CustomLog logs/access_log combined
</IfModule>
##设定默认CGI脚本目录及别名
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/apache-2.2.6/cgi-bin/"
</IfModule>
##在以线程式MPM(worker)运行的Apache中设置用来与CGI守护进程通信的套接字文件名前缀
<IfModule cgid_module>
    Scriptsock logs/cgisock
</IfModule>
##设定默认CGI脚本目录的属性
<Directory "/usr/local/apache-2.2.6/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
##设定默认MIME内容类型
DefaultType text/plain

<IfModule mime_module>
##指定MIME类型映射文件
    TypesConfig conf/mime.types
##增加.Z .tgz的类型映射
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>

##启用内存映射
EnableMMAP on
##使用操作系统内核的sendfile支持来将文件发送到客户端
EnableSendfile on
##指定多路处理模块(MPM)配置文件并将其附加到主配置文件
Include conf/extra/httpd-mpm.conf
##指定多语言错误应答配置文件并将其附加到主配置文件
Include conf/extra/httpd-multilang-errordoc.conf
##指定目录列表配置文件并将其附加到主配置文件
#Include conf/extra/httpd-autoindex.conf
##指定语言配置文件并将其附加到主配置文件
Include conf/extra/httpd-languages.conf
##指定用户主目录配置文件并将其附加到主配置文件
#Include conf/extra/httpd-userdir.conf
##指定用于服务器信息和状态显示的配置文件并将其附加到主配置文件
#Include conf/extra/httpd-info.conf
##指定提供Apache文档访问的配置文件并将其附加到配置文件
#Include conf/extra/httpd-manual.conf
##指定DAV配置文件并将其附加到主配置文件
#Include conf/extra/httpd-dav.conf
##指定与Apache服务自身相关的配置文件并将其附加到主配置文件
Include conf/extra/httpd-default.conf
##指定mod_deflate压缩模块配置文件并将其附加到主配置文件
Include conf/extra/httpd-deflate.conf
##指定mod_expires模块配置文件并将其附加到主配置文件
Include conf/extra/httpd-expires.conf
##指定虚拟主机配置文件并将其附加到主配置文件
#Include conf/extra/httpd-vhosts.conf
##指定SSL配置文件并将其附加到主配置文件
Include conf/extra/httpd-ssl.conf
##SSL默认配置
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

linux
相关资讯       Apache配置 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款