这几天折腾nginx然后遇到的的问题一一记录下来下次方便自查
> ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --add-module=../ngx_cache_purge-2.2
../ngx_cache_purge-2.2/ngx_cache_purge_module.c
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_fastcgi_cache_purge_conf’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:274:30: 错误:比较指针和整数 [-Werror]
if (flcf->upstream.cache != NGX_CONF_UNSET_PTR
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:275:33: 错误:比较指针和整数 [-Werror]
&& flcf->upstream.cache != NULL)
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:291:26: 错误:赋值时将指针赋给整数,未作类型转换 [-Werror]
flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:293:30: 错误:比较指针和整数 [-Werror]
if (flcf->upstream.cache == NULL) {
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_fastcgi_cache_purge_handler’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:324:58: 错误:‘->’参数类型无效(有‘int’)
if (ngx_http_cache_purge_init(r, flcf->upstream.cache->data,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_proxy_cache_purge_conf’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:463:30: 错误:比较指针和整数 [-Werror]
if (plcf->upstream.cache != NGX_CONF_UNSET_PTR
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:464:33: 错误:比较指针和整数 [-Werror]
&& plcf->upstream.cache != NULL)
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:480:26: 错误:赋值时将指针赋给整数,未作类型转换 [-Werror]
plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:482:30: 错误:比较指针和整数 [-Werror]
if (plcf->upstream.cache == NULL) {
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_proxy_cache_purge_handler’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:513:58: 错误:‘->’参数类型无效(有‘int’)
if (ngx_http_cache_purge_init(r, plcf->upstream.cache->data,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_scgi_cache_purge_conf’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:594:30: 错误:比较指针和整数 [-Werror]
if (slcf->upstream.cache != NGX_CONF_UNSET_PTR
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:595:33: 错误:比较指针和整数 [-Werror]
&& slcf->upstream.cache != NULL)
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:611:26: 错误:赋值时将指针赋给整数,未作类型转换 [-Werror]
slcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:613:30: 错误:比较指针和整数 [-Werror]
if (slcf->upstream.cache == NULL) {
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_scgi_cache_purge_handler’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:644:58: 错误:‘->’参数类型无效(有‘int’)
if (ngx_http_cache_purge_init(r, slcf->upstream.cache->data,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_uwsgi_cache_purge_conf’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:748:30: 错误:比较指针和整数 [-Werror]
if (ulcf->upstream.cache != NGX_CONF_UNSET_PTR
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:749:33: 错误:比较指针和整数 [-Werror]
&& ulcf->upstream.cache != NULL)
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:765:26: 错误:赋值时将指针赋给整数,未作类型转换 [-Werror]
ulcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:767:30: 错误:比较指针和整数 [-Werror]
if (ulcf->upstream.cache == NULL) {
^
../ngx_cache_purge-2.2/ngx_cache_purge_module.c: 在函数‘ngx_http_uwsgi_cache_purge_handler’中:
../ngx_cache_purge-2.2/ngx_cache_purge_module.c:798:58: 错误:‘->’参数类型无效(有‘int’)
if (ngx_http_cache_purge_init(r, ulcf->upstream.cache->data,
上面编译的时候都会失败,是版本的原因我的是nginx1.14.0的版本 然后编译ngx_cache_purge-2.3以下的版本都会出现这种语法错误,然后我编译2.3的就ok
> ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --add-module=../ngx_cache_purge-2.3
sed -e "s|%%PREFIX%%|/usr/local/nginx|" \
-e "s|%%PID_PATH%%|/usr/local/nginx/logs/nginx.pid|" \
-e "s|%%CONF_PATH%%|/usr/local/nginx/conf/nginx.conf|" \
-e "s|%%ERROR_LOG_PATH%%|/usr/local/nginx/logs/error.log|" \
< man/nginx.8 > objs/nginx.8
make[1]: 离开目录“/usr/local/software/nginx-1.14.0”
上面就编译成功了
关于ngx_cache_purge的安装我是参照了几篇博客如果前面的步骤未完成同学可以试以下博主提供的方法