网站首页 > 技术教程 正文
简介
安装nginx的时候,依赖包是不用安装的,只要有源码就可以了。(包安装太多会引起冲突
安装脚本
#!/bin/bash
# author : Jalright
# date : 2020-02-24
# modify the version variable ,there you need !
nginx_version="1.14.2"
openssl_version="1.1.1d"
zlib_version="1.2.11"
pcre_version="8.44"
# the default install path , you can change it here
install_path="/usr/local/nginx"
# check file if exists , if not exit script.
function checkFile() {
if [ ! -f "$1" ]; then
echo "$1 is not exitst"
exit 1
fi
}
# install complie tools
yum -y install gcc gcc-c++ make wget tar
# temp dir
mkdir -p /tmp/make_nginx
cd /tmp/make_nginx
# download nginx
wget -c -t 0 -T 1200 http://nginx.org/download/nginx-${nginx_version}.tar.gz
checkFile nginx-${nginx_version}.tar.gz
# download openssl
wget -c -t 0 -T 1200 https://www.openssl.org/source/openssl-${openssl_version}.tar.gz
checkFile openssl-${openssl_version}.tar.gz
# download zlib for gizp
wget -c -t 0 -T 1200 http://zlib.net/zlib-${zlib_version}.tar.gz
checkFile zlib-${zlib_version}.tar.gz
# download pcre for regular expression
wget -c -t 0 -T 1200 ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${pcre_version}.tar.gz
checkFile pcre-${pcre_version}.tar.gz
# Don't need install the dependent packages , we juse need source code .
# When we compile nginx , it will compile with other dependent source code auto.
tar zxf openssl-${openssl_version}.tar.gz
tar zxf zlib-${zlib_version}.tar.gz
tar zxf pcre-${pcre_version}.tar.gz
tar zxf nginx-${nginx_version}.tar.gz
cd nginx-${nginx_version}
# default compile with http2 module 、ssl、status ... If you need other module , you can modify it here.
./configure --prefix=${install_path} --user=www --group=www --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_stub_status_module --with-openssl=../openssl-${openssl_version} --with-pcre=../pcre-${pcre_version} --with-zlib=../zlib-${zlib_version}
make
make install
# crete work user
useradd -M -s /sbin/nologin www
总结
可以根据实际需求,简单修改一下脚本即可。不修改就是用默认的。
猜你喜欢
- 2024-10-10 Nginx之进程间的通信机制(共享内存、原子操作)
- 2024-09-12 Linux下安装JDK和Nginx(linuxyum安装jdk1.8)
- 2024-09-12 Linux安装Nginx(linux安装jdk)
- 2024-09-12 Linux邂逅Nginx——上高速篇(linux nginx使用)
- 2024-09-12 在linux系统上安装以及配置 nginx-1.20.1.tar.gz
- 2024-09-12 Nginx详细总结(建议收藏)(nginx详细讲解)
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)