报错锦集二“nginx: [emerg] unknown directive “set_real_ip_from“ in /usr/local/nginx/conf/nginx.conf:50 ngi

Posted 水木,年華

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了报错锦集二“nginx: [emerg] unknown directive “set_real_ip_from“ in /usr/local/nginx/conf/nginx.conf:50 ngi相关的知识,希望对你有一定的参考价值。

报错锦集二“nginx: [emerg] unknown directive "set_real_ip_from" in /usr/local/nginx/conf/nginx.conf:50 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed”的报错解决方法


nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed”的报错解决方法)

报错描述

nginx: [emerg] unknown directive “set_real_ip_from” in /usr/local/nginx/conf/nginx.conf:50
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

问题描述

我在做一台nginx对应两台动态处理的服务Tomcat的时候,修改nginx配置文件出现如下报错

[root@localhost local]# nginx -t 
nginx: [emerg] unknown directive "set_real_ip_from" in /usr/local/nginx/conf/nginx.conf:50
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
[root@localhost local]# 

原因分析

因为nginx缺少了realip模块

解决方法

重新添加realip模块编译

--with-http_realip_module 

重新编译

 ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_realip_module  
 make && make install

问题解决

[root@localhost nginx-1.15.9]# nginx -t 
nginx: [warn] low address bits of 192.168.56.1/24 are meaningless in /usr/local/nginx/conf/nginx.conf:50
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

以上是关于报错锦集二“nginx: [emerg] unknown directive “set_real_ip_from“ in /usr/local/nginx/conf/nginx.conf:50 ngi的主要内容,如果未能解决你的问题,请参考以下文章

Python - - MySQL数据库 - - 报错锦集

SQL易错锦集

GHGL项目-其他问题锦集

Jmeter 问题锦集

Dev-C++ 小问题锦集

iOS--碎片知识锦集