Linux 编译安装 Nginx
Nginx Linux OpenSSL 大约 2341 字下载解压
wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.16.1
查看模块支持
./configure --help
安装配置
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream
缺少 pcre、OpenSSL 依赖
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
下载依赖
无需安装。
pcre
wget https://netix.dl.sourceforge.net/project/pcre/pcre/8.43/pcre-8.43.tar.gz
tar -zxvf pcre-8.43.tar.gz
OpenSSL
wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
tar -zxvf openssl-1.1.0h.tar.gz
编译出错
cd /usr/local/pcre/bin \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: line 2: ./configure: No such file or directory
make[1]: *** [/usr/local/pcre/bin/Makefile] Error 127
make[1]: Leaving directory `/home/root/nginx-1.16.1'
make: *** [build] Error 2
cd /usr/local/openssl/bin/ \
&& if [ -f Makefile ]; then make clean; fi \
&& ./config --prefix=/usr/local/openssl/bin//.openssl no-shared no-threads \
&& make \
&& make install_sw LIBDIR=lib
/bin/sh: line 2: ./config: No such file or directory
make[1]: *** [/usr/local/openssl/bin//.openssl/include/openssl/ssl.h] Error 127
make[1]: Leaving directory `/home/root/nginx-1.16.1'
make: *** [build] Error 2
指定依赖路径
--with-pcre
、--with-openssl
指定到依赖的根目录即可,无需指定到bin目录。
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream --with-pcre=/home/root/pcre-8.40/ --with-openssl=/home/root/openssl-1.1.0h/
编译
先不一起执行make install
,编译成功后,进入objs/
目录下,执行./nginx -t
和./nginx -V
检查
make
安装
make install
运行
指定了--prefix
,安装好后到/usr/local/nginx/sbin
下运行即可。
./nginx
官网
阅读 4320 · 发布于 2019-04-19
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Windows 添加用户到指定用户组阅读 1218
-
IDEA 滚轮调节字体大小阅读 2489
-
走进 Spring Boot 第一步之 Java Properties 类阅读 2512
-
Android ScrollView 嵌套 ListView 问题阅读 1503
-
配置 Angular 10 运行环境阅读 1790
-
Spring Boot 统一修改 Controller 返回值阅读 959
-
Java 语法糖 - 增强 for 循环阅读 1099
-
Maven Fatal error compiling: 错误: 无效的目标发行版:17 -> [Help 1]阅读 2795
-
SCSS 样式阅读 1972
-
走进 Rust:trait阅读 2399