Ubuntu 18.04环境下编译Nginx动态模块,./configure文件在哪里?
Hey there! Let's sort out why you can't find the ./configure file and how to get it sorted:
为什么找不到?
If you installed Nginx via Ubuntu's default apt package manager, you only got pre-compiled binary files—not the source code that includes the ./configure script. That's the most common reason for this issue.
步骤1:确认当前Nginx版本
First, check exactly which version of Nginx you're running (you need source code that matches this version perfectly):
nginx -v
You'll get output like nginx version: nginx/1.14.0 (this is the default version for Ubuntu 18.04).
步骤2:安装编译依赖
Before working with the source code, install the tools and libraries required for compiling Nginx modules:
sudo apt update sudo apt install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev
步骤3:下载对应版本的Nginx源码
Grab the source tarball that matches your Nginx version from the official Nginx download page. For example, if you're on version 1.14.0, you'll want the nginx-1.14.0.tar.gz file.
步骤4:解压并找到./configure
Unpack the downloaded tarball and enter the source directory—you'll find the ./configure script here:
tar -xzf nginx-1.14.0.tar.gz cd nginx-1.14.0
Run ls and you'll see the configure file right in this directory.
关键提示:编译动态模块的重要细节
When compiling your dynamic module, you need to use the same configure arguments that your installed Nginx was built with. To get those arguments, run:
nginx -V
Look for the configure arguments: line in the output. When you run ./configure for your module, append --add-dynamic-module=/path/to/your/module/source to that existing list of arguments.
如果你原本是源码安装的Nginx?
If you originally installed Nginx from source code, the ./configure file is in the source directory you used during that installation. If you can't locate it now, you might have deleted the directory—just re-download the matching source code following the steps above.
内容的提问来源于stack exchange,提问作者pet21221

