centos7 源码编译安装nginx教程 nginx安装脚本 lua-nginx-module
- 安装nginx需要pcre zlib openssl的库,下文都是在官网直接下载用作编译安装
- 该nginx安装教程,有安装maxmind IP 库
- 该nginx安装教程有安装lua-nginx-module, 但是建议如果要用lua-nginx-module的时候使用Tengine或者Openrestry
- 系统使用了centos 7
- 该教程有修改最大打开文件描述符数到最大
- 该教程是nginx安装的shell脚本
#!/bin/bash yum install epel-release -y
yum install gcc gcc-c++ make automake autoconf libtool iptables-services wget bind-utils unzip -y cd /usr/local/src
rm -rf * mv /etc/localtime /etc/localtime.bak
/bin/cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'ZONE="CST"' > /etc/sysconfig/clock setenforce
sed -i "s/=enforcing/=disabled/g" /etc/selinux/config systemctl disable firewalld
systemctl stop firewalld chkconfig iptables on
service iptables start
iptables -F
service iptables save wget https://github.com/openresty/luajit2/archive/v2.1-agentzh.zip
unzip v2.-agentzh.zip cd luajit2-2.1-agentzh
mkdir -p /usr/local/nginx/
make install PREFIX=/usr/local/nginx/luajit
echo "/usr/local/nginx/luajit/lib" > /etc/ld.so.conf.d/usr_local_luajit_lib.conf
ldconfig cd /usr/local/src/
wget https://github.com/maxmind/libmaxminddb/releases/download/1.3.2/libmaxminddb-1.3.2.tar.gz
tar zxf libmaxminddb-1.3.2.tar.gz
cd libmaxminddb-1.3.2
./configure
make && make install
[[ -z `cat /etc/ld.so.conf |grep "\/usr\/local\/lib"` ]] && echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig mkdir -p /usr/local/nginx/temp
mkdir -p /usr/local/nginx/geoip
cd /usr/local/nginx/geoip wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
tar zxf GeoLite2-City.tar.gz
cd GeoLite2-City_*
mv GeoLite2-City.mmdb maxmind-city.mmdb
mv maxmind-city.mmdb /usr/local/nginx/geoip/ cd /usr/local/src/
wget http://nginx.org/download/nginx-1.16.1.tar.gz
tar zxf nginx-1.16.1.tar.gz wget -O openssl-master.zip https://github.com/openssl/openssl/archive/master.zip
unzip openssl-master.zip wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar xzf pcre-8.43.tar.gz wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2..tar.gz #wget -O lua-nginx-module-master.zip https://github.com/openresty/lua-nginx-module/archive/master.zip
wget http://download.zhufunin.com/lua-nginx-module.zip
unzip lua-nginx-module.zip
wget -O ngx_devel_kit-master.zip https://github.com/simplresty/ngx_devel_kit/archive/master.zip
unzip ngx_devel_kit-master.zip
wget -O ngx_http_geoip2_module-master.zip https://github.com/leev/ngx_http_geoip2_module/archive/master.zip
unzip ngx_http_geoip2_module-master.zip useradd -M -s /sbin/nologin www export LUAJIT_LIB=/usr/local/nginx/luajit/lib
export LUAJIT_INC=/usr/local/nginx/luajit/include/luajit-2.1 cd /usr/local/src/nginx-1.16.1
./configure \
--user=www \
--group=www \
--prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_gzip_static_module \
--with-http_gunzip_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-pcre-jit \
--with-http_v2_module \
--error-log-path=/usr/local/nginx/logs/error.log \
--http-log-path=/usr/local/nginx/logs/access.log \
--http-client-body-temp-path=/usr/local/nginx/temp/client_body_temp \
--http-proxy-temp-path=/usr/local/nginx/temp/proxy_temp \
--http-fastcgi-temp-path=/usr/local/nginx/temp/fastcgi_temp \
--http-scgi-temp-path=/usr/local/nginx/temp/scgi_temp \
--http-uwsgi-temp-path=/usr/local/nginx/temp/uwsgi_temp \
--with-openssl=/usr/local/src/openssl-master \
--with-zlib=/usr/local/src/zlib-1.2. \
--with-pcre=/usr/local/src/pcre-8.43 \
--with-ld-opt='-ljemalloc' \
--with-ld-opt='-Wl,-rpath,/usr/local/nginx/luajit/lib' \
--add-module=/usr/local/src/ngx_devel_kit-master \
--add-module=/usr/local/src/lua-nginx-module-master \
--add-module=/usr/local/src/ngx_http_geoip2_module-master make && make install echo "export PATH=$PATH:/usr/local/nginx/sbin/" >> /etc/profile
source /etc/profile mkdir -p /usr/local/nginx/ssl openssl req -x509 -nodes -days -newkey rsa: -keyout /usr/local/nginx/ssl/nginx.key -out /usr/local/nginx/ssl/nginx.crt -subj "/C=US/ST=US/L=US/O=ssl/OU=ssl/CN=ssl.com/emailAddress=admin@ssl.com" echo "ulimit -n 65535" >> /etc/profile
echo "root soft nofile 65535" >> /etc/security/limits.conf
echo "root hard nofile 65535" >> /etc/security/limits.conf
echo "* soft nofile 65535" >> /etc/security/limits.conf
echo "* hard nofile 65535" >> /etc/security/limits.conf
source /etc/profile
centos7 源码编译安装nginx教程 nginx安装脚本 lua-nginx-module的更多相关文章
- Centos7源码编译安装PHP7.2(生产环境)
安装PHP依赖包,否则在编译的过程中可能会出现各种报错 # Centos 安装epel-release源并将系统包更新到最新版本 $ yum install epel-release-y $ yum ...
- centos7源码编译安装lamp/lnmp
centos7源码编译安装lamp/lnmp 进程:是包工头(相当于是个门,只管开门关门,不管门内的事儿) 线程:是各种工种(cpu调度的是线程) 进程 是一件事情, 线程 是 同一个时间范围内 同时 ...
- CentOS7 源码编译安装Nginx
源码编译安装nginx 1.下载nginx源码包(这里以nginx-1.18.0为例) wget http://nginx.org/download/nginx-1.18.0.tar.gz 2 ...
- centos7 源码编译安装TensorFlow CPU 版本
一.前言 我们都知道,普通使用pip安装的TensorFlow是万金油版本,当你运行的时候,会提示你不是当前电脑中最优的版本,特别是CPU版本,没有使用指令集优化会让TensorFlow用起来更慢. ...
- centos7源码编译安装Subversion 1.9.5
svn是Subversion的简称,是一个开放源代码的版本控制系统.svn有两种运行方式:1.独立服务器(svn://xxx.xxx/xxx) 2.借助apache(http://svn.xxx.xx ...
- Centos7源码编译安装mysql8
前面介绍了很多关于mysql的文章,下面主要介绍一下mysql8的源码编译安装 一 基本环境 [root@CentOS-7-x86-64-Minimal-1810 ~]# cd /usr/local/ ...
- centos7 源码编译安装 nginx
安装步骤 下载 nginx 源码包 官网 $ wget http://nginx.org/download/nginx-1.16.0.tar.gz 解压 nginx 压缩包 $ tar -zxvf n ...
- centos7源码编译安装LNMP+ZABBIX4.0LTS(1)——nginx
环境:192.168.117.132--zabbix server192.168.117.133--zabbix proxy 安装路径为/zabbix 安装nginx 1.安装包下载http://ng ...
- centos7 源码编译nginx
使用configure命令配置编译.它定义了系统的各个方面,包括允许使用 nginx 进行连接处理的方法.最后它创建一个Makefile.该configure命令支持以下参数: --prefix=pa ...
随机推荐
- 初识linux&常用命令&目录文件的浏览和管理
Linux系统的主要用途:主要用于服器务器,特别是网络服务 Linux命令格式 命令 [选项] [ 参数] 命令:告诉操作系统做什么,执行什么 选项:说明命令的运行方式(可以改变命令的功能).选 ...
- bugkuCTF-管理员系统(IP伪造)
题目地址:http://123.206.31.85:1003/ 登进去是一个管理员后台登录的样子 试了sql的万能密码,发现进不了,而且下面还报错了ip禁止 禁止了我们的ip,但是他本地的ip肯定没有 ...
- 题解 P5712 【【深基3.例4】Apples】
题目传送门 思路 仔细读题后,我们可以发现,输出可以分成\(2\)种情况,apple加s与apple不加s,所以我们可以使用if/else来实现. 接着,我们读入n. int n; cin>&g ...
- std::ref和std::cref使用(转载)
转载于:https://blog.csdn.net/lmb1612977696/article/details/81543802 std::ref和std::cref 解释: std::ref 用于包 ...
- div中宽高度自适应文字换行居中问题解决
<html> <head> <meta charset="UTF-8"/> <title>div中宽高度自适应文字换行居中demo& ...
- Python学习笔记三:数据特征分析
完成数据清理后,下面通过图表展开对数据的分析. 1.前期初判(分布分析): 1)判断分组区间: # a.散点图:plt.scatter(data[字段1],data['字段2'], s = data[ ...
- Java实现的上传并压缩图片功能【可等比例压缩或原尺寸压缩】
本文实例讲述了Java实现的上传并压缩图片功能.分享给大家供大家参考,具体如下: 先看效果: 原图:1.33M 处理后:27.4kb 关键代码: package codeGenerate.util; ...
- reids中删除某个前缀的所有key
需求:reids中删除某个前缀的所有key 说明:代码中的0:2标识从key前缀中截取前2个字符,这里示例的时候比如“b_”前缀,使用时候根据实际情况截取对应的长度进行判断即可. 生成测试数据 #!/ ...
- 爬虫学习笔记2requests库和beautifulsoup4库学习笔记
目录 1.requests库 1.1 安装 2.beautifulsoup4 2.1 常用方法 2.2 bs4 中四大对象种类 2.3 遍历文档树 2.4 搜索文档树 查询id=head的Tag 查询 ...
- chrome json接口数据 插件
chrome json接口数据 插件 JSON-Handle 官网 下载后 地址栏输入 chrome://extensions/ 将下载的文件拖入页面 OK