网站首页 > 精选教程 正文
简介
安装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
总结
可以根据实际需求,简单修改一下脚本即可。不修改就是用默认的。
- 上一篇: php源码安装,如何使用源码的方式安装PHP环境
- 下一篇: linux源码编译安装操作
猜你喜欢
- 2024-09-24 轻松使用Shell编程搭建Nginx WEB服务器
- 2024-09-24 centos nginx源码shell脚本安装
- 2024-09-24 源码安装nginx1.21.6
- 2024-09-24 linux源码编译安装操作
- 2024-09-24 php源码安装,如何使用源码的方式安装PHP环境
你 发表评论:
欢迎- 最近发表
-
- java 服务之间调用(rpc)(java实现服务器)
- Java机器学习库(Java ML)(二、聚类)
- 「Java库」如何使用优秀的加密库Jasypt来保护你的敏感信息?
- GitHub精选 | 轻量级Android和Java日志库
- Java面试官:MySQL binlog 有什么作用?主从延迟的了解么?
- Excel函数核武器库:50个高频场景公式——第二弹
- Excel函数核武器库:50个高频场景公式——第一弹
- Spring Cache高性能缓存库 - Caffeine简介
- Java通过Kafka Streams库来实现数据流处理
- 一连问了好几个大佬,竟然都不知道Redis为什么默认16个数据库?
- 标签列表
-
- nginx反向代理 (57)
- nginx日志 (56)
- nginx限制ip访问 (62)
- mac安装nginx (55)
- java和mysql (59)
- java中final (62)
- win10安装java (72)
- java启动参数 (64)
- java链表反转 (64)
- 字符串反转java (72)
- java逻辑运算符 (59)
- java 请求url (65)
- java信号量 (57)
- java定义枚举 (59)
- java字符串压缩 (56)
- java中的反射 (59)
- java 三维数组 (55)
- java插入排序 (68)
- java线程的状态 (62)
- java异步调用 (55)
- java中的异常处理 (62)
- java锁机制 (54)
- java静态内部类 (55)
- java怎么添加图片 (60)
- java 权限框架 (55)
本文暂时没有评论,来添加一个吧(●'◡'●)