wamp集成开发环境httpd.conf注解

来源:互联网 发布:淘宝新店如何做起来 编辑:程序博客网 时间:2024/06/05 10:03

参考了几个大牛的博客,总结了一下apache配置文件的内容含义:请不吝指点!

//服务器根目录

ServerRoot "D:/wamp/bin/apache/apache2.4.4" 
//监听端口
Listen 80
//必须修改<IfModule unixd_module>中的所属用户和组。后面添加虚拟路径的文件夹必须拥有这个用户和组的读写权限,否则会报权限的错。
<IfModule unixd_module>
    User daemon
    Group daemon
</IfModule>
//管理员的邮箱
ServerAdmin admin@example.com
//用来设置服务器用于辨识自己的主机名和端口号。主要用于创建重定向URL。
ServerName localhost


<Directory />
    AllowOverride none
    //在 AllowOverride 设置为 None 时,.htaccess 文件将被完全忽略。当此指令设置为All时,所有具有“.htaccess” 作用域的指令都允许出现在.htaccess 文件中。
    Require all granted
</Directory>


//文件根目录
DocumentRoot "D:/wamp/www"


<Directory "D:/wamp/www">
    Options Indexes FollowSymLinks
    //Options这个子句用来说明一些主要的设置,目前可以使用的设置有Indexes,Includes,FollowSymLinks,ExecCGI,MultiView,当然还有两个最简单的选择就是None和All。None是禁止所有选择,而All 允许上面的所有Options。一般我们主要关心的是Indexes 和FollowSymLinks。Indexes 是设定是否允许在目录下面没有index.html 的时候显示目录,而FollowSymLinks 决定是否可以通过符号连接跨越DocumentRoot。在Indexes前,加 + 代表允许目录浏览;加 – 代表禁止目录浏览。
    AllowOverride All
    //AllowOverride 定义是否允许各个目录用目录中的.htaccess(后面解释)覆盖这里设定的Options。它的选择有Options,FileInfo,AuthConfig,Limit 或者它们的组合,当然还有None 和All。


    Order Deny,Allow
    //Order 它有两种用法,即Order allow,deny 或者Order deny,allow。简单地说,它用来设置是先执行deny 还是先执行allow,例如,Order deny,allow 意味着先看deny 行,再看allow 行,这样如果deny from all 再allow from 202.112.58.0/24 后来的allow子句就会超越deny 而对202.112.58.x 打开访问。
     Deny from all
     Allow from 127.0.0.1
     Allow from ::1
     Allow from localhost
    //Allow/Deny from 这两个选项和Order 一起使用,Allow 允许某个地址来的连接请求,Deny 则禁止这个请求
</Directory>


//设置默认目录资源列表文件
<IfModule dir_module>
    DirectoryIndex index.php index.php3 index.html index.htm
</IfModule>


//拒绝对.ht开头文件的访问,以保护.htaccess文件
<Files ".ht*">
    Require all denied
</Files>


//错误日志路径
ErrorLog "D:/wamp/logs/apache_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>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>


    //使用CustomLog参数设置访问日志的位置和格式
    CustomLog "logs/access.log" common
    CustomLog "D:/wamp/logs/access.log" common


    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access.log" combined
</IfModule>


<IfModule alias_module>
    //设定默认CGI脚本目录及别名
    ScriptAlias /cgi-bin/ "D:/wamp/cgi-bin/"
</IfModule>


//在以线程式MPM(worker)运行的Apache中设置用来与CGI守护进程通信的套接字文件名前缀
<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock
</IfModule>


//设定默认CGI脚本目录的属性
<Directory "D:/wamp/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>


<IfModule mime_module>
    //指定MIME类型映射文件
    TypesConfig conf/mime.types


    //增加.Z .tgz等的类型映射
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .php3
</IfModule>


//mod_mime_magic模块可使server由文件内容决定其MIME类型。如果有载入mod_mime_magic模块,才会处理MIMEMagicFile这一段。如果是…,则表示如果没有载入该模块,才会处理这一段
#MIMEMagicFile conf/magic


#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#


#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited


//关闭(启用)内存映射
#EnableMMAP off


//使用操作系统内核的sendfile支持来将文件发送到客户端
#EnableSendfile on


//指定多路处理模块(MPM)配置文件并将其附加到主配置文件
# Server-pool management (MPM specific)
Include conf/extra/httpd-mpm.conf


//指定多语言错误应答配置文件并将其附加到主配置文件
# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf


//指定目录列表配置文件并将其附加到主配置文件
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf


//指定语言配置文件并将其附加到主配置文件
# Language settings
#Include conf/extra/httpd-languages.conf


//指定用户主目录配置文件并将其附加到主配置文件
# User home directories
#Include conf/extra/httpd-userdir.conf


//指定用于服务器信息和状态显示的配置文件并将其附加到主配置文件
# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf


//指定虚拟主机配置文件并将其附加到主配置文件
# Virtual hosts
Include conf/extra/httpd-vhosts.conf


//指定提供Apache文档访问的配置文件并将其附加到配置文件
# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf


//指定DAV配置文件并将其附加到主配置文件
# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf


//指定与Apache服务自身相关的配置文件并将其附加到主配置文件
# Various default settings
#Include conf/extra/httpd-default.conf


# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>


//SSL默认配置
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


#<IfModule setenvif_module>
#BrowserMatch "MSIE 10.0;" bad_DNT
#</IfModule>
#<IfModule headers_module>
#RequestHeader unset DNT env=bad_DNT
#</IfModule>


IncludeOptional "D:/wamp/vhosts/*"

Include "D:/wamp/alias/*"


http://jafy00.blog.51cto.com/2594646/508205

http://blog.chinaunix.net/uid-1861701-id-86891.html

http://zhanshenny.iteye.com/blog/1654332

0 0
原创粉丝点击