Linux 源码安装nginx

编译参数详解:https://www.cnblogs.com/houyongchong/p/compileArgs.html

配置参数详解:https://www.cnblogs.com/houyongchong/p/configureArgs.html

安装扩展、依赖包

tar -zxf LuaJIT-2.0.5.tar.gz -C /usr/local/src/
cd LuaJIT-2.0.5/
make
make install
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0

tar -zxf nginx-sticky-module-1.1.tar.gz -C /usr/local/src/

tar -zxf ngx_cache_purge-2.3.tar.gz -C /usr/local/src/

tar xf pcre-8.40.tar.gz -C /usr/local/src/

tar -zxf lua-nginx-module-0.10.8.tar.gz -C /usr/local/src/

tar -zxf nginx_upstream_check_module-0.3.0.tar.gz -C /usr/local/src/

tar -zxf ngx_devel_kit-0.3.0.tar.gz -C /usr/local/src/

tar -zxf set-misc-nginx-module-0.31.tar.gz -C /usr/local/src/

tar -zxf openssl-1.0.2l.tar.gz -C /usr/local/src/

tar -zxf zlib-1.2.11.tar.gz -C /usr/local/src/

unzip nginx-upstream-fair-master.zip
mv nginx-upstream-fair-master /usr/local/src/

chown -R root.root /local/src/

安装nginx

useradd -M -s /sbin/nologin nginx
tar -zxf nginx-1.10.3.tar.gz
chown -R root.root ./nginx-1.10.3
cd nginx-1.10.3
./configure \
    --prefix=/app/nginx \
    --conf-path=/app/nginx/conf/nginx.conf \
    --sbin-path=/app/nginx/sbin/nginx \
    --http-log-path=/app/nginx/logs/access.log \
    --error-log-path=/app/nginx/logs/error.log \
    --pid-path=/app/nginx/logs/nginx.pid \
    --lock-path=/app/nginx/logs/nginx.lock \
    --with-ld-opt=-Wl,-rpath,/usr/local/lib \
    --with-pcre=/usr/local/src/pcre-8.42 \
    --with-zlib=/usr/local/src/zlib-1.2.11 \
    --with-openssl=/usr/local/src/openssl-1.0.2n \
    --add-module=/usr/local/src/nginx_upstream_check_module-0.3.0 \
    --add-module=/usr/local/src/nginx-sticky-module \
    --add-module=/usr/local/src/nginx-upstream-fair-master \
    --add-module=/usr/local/src/ngx_cache_purge-2.3 \
    --add-module=/usr/local/src/lua-nginx-module-0.10.13 \
    --add-module=/usr/local/src/ngx_devel_kit-0.3.0 \
    --add-module=/usr/local/src/set-misc-nginx-module-0.32 \
    --with-http_addition_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_gzip_static_module \
    --with-http_realip_module \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --user=nginx \
    --group=nginx
make
make install
chown -R nginx.nginx /app/nginx
posted @ 2019-03-05 09:49  houyongchong  阅读(339)  评论(0编辑  收藏  举报