/etc/init.d/nginx -V
nginx (OpenRC [XENU]) 0.9.2 (Gentoo Linux)
若我在编译时将 --with-http_realip_module 编译选项放到
--add-module=${HTTP_CHUNKIN_P} 之后, nginx -t 就不会报unknown directive
"real_ip_header" 的错. " HTTP_CHUNKIN_P 为包名,
从https://github.com/agentzh/chunkin-nginx-module/tarball/v0.23rc2 下载.
nginx 0.8.53 版本没发现这问题."
反之,问题就依旧.
2012/7/31 agentzh <age...@gmail.com>:
> Hello!
>
> On Mon, Jul 30, 2012 at 3:01 AM, Tony Lee wrote:
>> 遇到一个问题...
>> 我编译打了chunkin-nginx-module v0.23rc2 patch的nginx..
>> nginx版本 - nginx-1.1.17
>> 然后我在nginx.conf 里设置了: real_ip_header X-Real-IP;
>> /etc/init.d/nginx start
>>
>> * Checking nginx' configuration ...
>> nginx: [emerg] unknown directive "real_ip_header" in
>> /etc/nginx/nginx.conf:46
>> configuration file /etc/nginx/nginx.conf test failed
>> nginx: [emerg] unknown directive "real_ip_header" in
>> /etc/nginx/nginx.conf:46
>> configuration file /etc/nginx/nginx.conf test failed
>> * failed, please correct errors above
>> [ !! ]
>> * ERROR: nginx failed to start
>>
>> 出现了failed..
>> 错误似乎发生在 src/core/ngx_conf_file.c
>> if (multi == 0) {
>> ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
>> "unknown directive \"%s\"", name->data);
>> return NGX_ERROR;
>> }
>> 我去掉chunkin-nginx-module 的patch后就正常了.
>>
>> 希望能指点一二... 非常期待回复...
>
> 请注意以下两点:
>
> 1. ngx_chunkin v0.23rc2 是一个 nginx 模块,并非补丁。
> 2. 标准的 ngx_realip 默认是不启用的,你需要在 ./configure 时同时指定 --with-http_realip_module 选项。
>
> 你遇到的错误指示你忘记启用 nginx 标准的 ngx_realip 模块了,所以才会报这个模块的配置指令找不到。
>
> 如果问题依旧,请提供启用 ngx_chunkin 前后的 nginx -V 命令的输出 :)
>
> Best regards,
> -agentzh
>
> P.S. 同时抄送给 ngx_openresty
> 邮件列表:https://groups.google.com/group/openresty 也欢迎你加入 :)