kaisawind's blog
  • 关于
  • 所有帖子

nginx编译方法 - Thu, Mar 14, 2019

从nginx源码编译安装nginx

1. 下载代码

hg管理的源码库: http://hg.nginx.org/nginx/file/tip

github的只读库: https://github.com/nginx/nginx

2. 安装必要的编译软件

基本编译软件gcc g++ cmake automake

sudo apt-get install gcc g++ cmake automake

3. 安装必要的库文件

  • openssl
sudo apt-get install openssl libssl-dev
  • pcre
sudo apt-get install libpcre3 libpcre3-dev
  • zlib
sudo apt-get install zlib1g-dev

4. 配置nginx编译环境

./auto/configure  \
    --prefix=   \
    --with-debug \
    --sbin-path=nginx \
    --conf-path=conf/nginx.conf \
    --error-log-path=logs/error.log  \
    --http-log-path=logs/access.log  \
    --pid-path=logs/nginx.pid \
    --http-client-body-temp-path=temp/client_body_temp \
    --http-proxy-temp-path=temp/proxy/ \
    --http-fastcgi-temp-path=temp/fcgi/ \
    --http-uwsgi-temp-path=temp/uwsgi \
    --http-scgi-temp-path=temp/scgi \
    --with-http_ssl_module \
    --with-http_stub_status_module \
    --with-http_gzip_static_module \
    --with-pcre \
    --with-stream_ssl_module \
    --with-stream \
    --add-dynamic-module=../njs/nginx  #njs module

也可以修改文件\nginx\auto\options

5. 编译

make


辽ICP备2021007608号 | © 2025 | kaisawind

Facebook Twitter GitHub