admin avatar

nginx: [emerg] Solution to unknown directive "set_real_ip_from"

🕜 by admin

Nginx: [emerg] unknown directive" set_real_ip_from " appears because nginx is missing the realip module

Add the realip module to compile again. . .

1
2
3
4
5
6
7
8
9
10
11
12
./configure --prefix=/usr/local/nginx --user=www-data --group=www-data --pid-path=/var/run/ginx.pid \
   	--with-http_ssl_module              	\
   	--with-http_v2_module               	\
   	--with-http_v3_module               	\
             --with-http_stub_status_module     \
              --with-http_gzip_static_module   \
              --with-http_realip_module          \
             --add-module=/opt/ngx_brotli    \
   	--with-openssl=../quiche/deps/boringssl \
   	--with-quiche=../quiche \
             --with-pcre=/opt/pcre-8.44 \
            --with-zlib=/opt/zlib-1.2.11 

Remember to add the --with-http_realip_module module

If nginx is already online, just execute make, and then back up the old nginx process files,

Copy the compiled new nginx binary file to the nginx installation sbin directory

💘 相关文章

写一条评论