转到正文

走出Windows

抛弃Windows就是走向高效率

存档

分类: Nginx

在Flash上点右键->播放

点击下载该视频


本视频中涉及到的文件如下:
配置文件
讲解时的文本文件

继续阅读

在Flash上点右键->播放

点击下载该视频


本视频中涉及到的文件如下:
配置文件

讲解时的文本文件

继续阅读

log_format

语法: log_format name format [format ...]

默认: log_format combined "..."

上下文: http server

指令log_format描述了一个日志项的格式. 除了格式中的一般变量 it is possible to use variables which exist only at the moment of record into the log:

  • $body_bytes_sent, the number of bytes, transmitted to client minus the response headers, variable is compatible with parameter %B of module Apache's mod_log_config (this was called $apache_bytes_sent, before version 0.3.10)
  • $bytes_sent, the number of bytes, transmitted to client
  • $connection, the number of connection
  • $msec, the time with an accuracy to microseconds at the moment of the log entry
  • $pipe, "p" if request was pipelining
  • $request_length, the length of the body of the request
  • $request_time, the time of working on request in seconds, since 0.5.19 in millisecond precision
  • $status, status of answer
  • $time_local, local time into common log format.
  • $http_x_forwarded_for, X-Forward infomation

The headers, transmitted to client, begin from the prefix "sent_http_", for example, $sent_http_content_range.

Note that variables produced by other modules can also be logged. For example you can log upstream response headers with the prefix "upstream_http_", see upstream.

In the configuration there is always a predetermined format "combined":

log_format  combined  '$remote_addr - $remote_user [$time_local] '
                      '"$request" $status $body_bytes_sent '
                      '"$http_referer" "$http_user_agent"';

因为我要安装0.7.64版本,所以执行

# vim /usr/portage/www-servers/nginx/nginx-0.7.64.ebuild

因为我的 nginx-accesskey 放在 /root/nginx-accesskey 所以在 ./configure \ 下面加一句

--add-module=/root/nginx-accesskey \

# ebuild /usr/portage/www-servers/nginx/nginx-0.7.64.ebuild manifest

修改一下 /root/nginx-accesskey/config

#vim /root/nginx-accesskey/config

将 "$HTTP_ACCESSKEY_MODULE" 替换成 "ngx_http_accesskey_module"

然后执行

# vim /etc/portage/package.keywords

添加一行

=www-servers/nginx-0.7.64 ~x86

最后

# emerge =nginx-0.7.64

安装成功,配置参考
http://wiki.nginx.org/NginxChsHttpAccessKeyModule