nginx反向代理编译异常
cc1: warnings being treated as errors /root/nginx_tcp_proxy_module/ngx_tcp.c: 在函数‘ngx_tcp_add_addrs’中: /root/nginx_tcp_proxy_module/ngx_tcp.c:479: 错误:传递‘ngx_sock_ntop’的第 2 个参数时将指针赋给整数,未作类型转换 src/core/ngx_inet.h:110: 附注:需要类型‘socklen_t’,但实参的类型为‘u_char *’ /root/nginx_tcp_proxy_module/ngx_tcp.c:479: 错误:传递‘ngx_sock_ntop’的第 3 个参数时将整数赋给指针,未作类型转换 src/core/ngx_inet.h:110: 附注:需要类型‘u_char *’,但实参的类型为‘long unsigned int’ /root/nginx_tcp_proxy_module/ngx_tcp.c:479: 错误:提供给函数‘ngx_sock_ntop’的实参太少 make[1]: *** [objs/addon/nginx_tcp_proxy_module/ngx_tcp.o] 错误 1 make[1]: Leaving directory `/root/nginx-1.8.1' make: *** [build] 错误 2
错误原因,socket代理编译时候检测到nginx版本不对,抛出异常
修改/root/nginx-1.8.1/src/http/ngx_http_header_filter_module.c
static char ngx_http_server_string[] = "Server: xxxx" CRLF;
static char ngx_http_server_full_string[] = "Server:xxxx/1.0" CRLF;
修改/root/nginx-1.8.1/src/core/nginx.h
#define nginx_version 1008001
#define NGINX_VERSION "1.8.1"
#define NGINX_VER "xxxx/" NGINX_VERSION
#ifdef NGX_BUILD
#define NGINX_VER_BUILD NGINX_VER " (" NGX_BUILD ")"
#else
#define NGINX_VER_BUILD NGINX_VER
#endif
#define NGINX_VAR "xxxx"
#define NGX_OLDPID_EXT ".oldbin"
查看结果
可以看到server响应头按自定义设置的显示