Apache

主要配置文件httpd.conf,通过命令查看去除注释和空格行的配置:egrep -v "^.*#|^$" httpd.conf

通过域名访问的时候,需配置host。

非80端口,访问的时候加上端口号。

ServerRoot "/src/httpd" #apache category
Listen 80  #listen port
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
User daemon 
Group daemon
</IfModule>
</IfModule>
ServerAdmin you@example.com #管理员的邮件地址
ServerName 127.0.0.1:80
DocumentRoot "/src/httpd/htdocs" #发布目录,首页index
<Directory />
Options FollowSymLinks Includes
AllowOverride None
Order allow,deny
Allow from all
Satisfy all
</Directory>
<Directory "/src/httpd/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<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>
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/src/httpd/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/src/httpd/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
DefaultType text/plain
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml .html .htm
AddOutputFilter INCLUDES .shtml .html .htm
</IfModule>
Include conf/extra/httpd-vhosts.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

格式中的各个参数如下: 

%h --客户端的ip地址或主机名 

%l --The 这是由客户端 identd 判断的RFC 1413身份,输出中的符号 "-" 表示此处信息无效。 

%u --由HTTP认证系统得到的访问该网页的客户名。有认证时才有效,输出中的符号 "-" 表示此处信息无效。 

%t --服务器完成对请求的处理时的时间。 

"%r" --引号中是客户发出的包含了许多有用信息的请求内容。 

%>s --这个是服务器返回给客户端的状态码。 

%b --返回给客户端的不包括响应头的字节数。 

"%{Referer}i" --请求是从被哪个网页提交过来的。 

"%{User-Agent}i" --浏览器识别信息。 

posted on 2017-06-22 17:37  yingyi  阅读(117)  评论(0编辑  收藏  举报