天天看點

報錯:nginx: [emerg] unknown directive “set_real_ip_from“ in /usr/local/nginx/conf/nginx.conf:50報錯項報錯原因解決方案

文章目錄

  • 報錯項
  • 報錯原因
  • 解決方案

報錯項

在開啟nginx擷取用戶端IP位址子產品功能的時候,啟動報錯

報錯原因

nginx在編譯安裝的時候沒有開啟 --with-http_realip_module 該子產品功能(擷取用戶端IP位址)

解決方案

重新編譯安裝ngixn,./configure 配置是開啟 --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
           

繼續閱讀