• 安装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的更多相关文章

  1. Centos7源码编译安装PHP7.2(生产环境)

    安装PHP依赖包,否则在编译的过程中可能会出现各种报错 # Centos 安装epel-release源并将系统包更新到最新版本 $ yum install epel-release-y $ yum ...

  2. centos7源码编译安装lamp/lnmp

    centos7源码编译安装lamp/lnmp 进程:是包工头(相当于是个门,只管开门关门,不管门内的事儿) 线程:是各种工种(cpu调度的是线程) 进程 是一件事情, 线程 是 同一个时间范围内 同时 ...

  3. CentOS7 源码编译安装Nginx

    源码编译安装nginx     1.下载nginx源码包(这里以nginx-1.18.0为例) wget http://nginx.org/download/nginx-1.18.0.tar.gz 2 ...

  4. centos7 源码编译安装TensorFlow CPU 版本

    一.前言 我们都知道,普通使用pip安装的TensorFlow是万金油版本,当你运行的时候,会提示你不是当前电脑中最优的版本,特别是CPU版本,没有使用指令集优化会让TensorFlow用起来更慢. ...

  5. centos7源码编译安装Subversion 1.9.5

    svn是Subversion的简称,是一个开放源代码的版本控制系统.svn有两种运行方式:1.独立服务器(svn://xxx.xxx/xxx) 2.借助apache(http://svn.xxx.xx ...

  6. Centos7源码编译安装mysql8

    前面介绍了很多关于mysql的文章,下面主要介绍一下mysql8的源码编译安装 一 基本环境 [root@CentOS-7-x86-64-Minimal-1810 ~]# cd /usr/local/ ...

  7. centos7 源码编译安装 nginx

    安装步骤 下载 nginx 源码包 官网 $ wget http://nginx.org/download/nginx-1.16.0.tar.gz 解压 nginx 压缩包 $ tar -zxvf n ...

  8. centos7源码编译安装LNMP+ZABBIX4.0LTS(1)——nginx

    环境:192.168.117.132--zabbix server192.168.117.133--zabbix proxy 安装路径为/zabbix 安装nginx 1.安装包下载http://ng ...

  9. centos7 源码编译nginx

    使用configure命令配置编译.它定义了系统的各个方面,包括允许使用 nginx 进行连接处理的方法.最后它创建一个Makefile.该configure命令支持以下参数: --prefix=pa ...

随机推荐

  1. R ggplot学习笔记1

    R 可视化学习笔记 记参数挺费劲的,还是用的时候查官方文档吧,现在记个大概就行吧~ 1.ggplot2分层次绘图 1.1 核心理念 把绘图与数据分离,把数据相关的绘图与数据无关的绘图分离,按图层作图. ...

  2. JavaScript实现动态打字效果

    废话不多说,上代码~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset=&qu ...

  3. 注解配置springMVC

    在随笔“springMVC项目配置文件”的基础上,进行优化,使用注解配置,控制器类得以简化: 一.注解配置springMVC 1.在HelloController类中,去除实现的Controller接 ...

  4. PAT (Basic Level) Practice (中文)1029 旧键盘 (20 分)

    旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现.现在给出应该输入的一段文字.以及实际被输入的文字,请你列出肯定坏掉的那些键. 输入格式: 输入在 2 行中分别给出应该输入的文字.以及 ...

  5. C语言 while

    C语言 while while 语句 流程图 案例 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stri ...

  6. ZedGraph怎样实现将图形右键菜单的打印和页面设置合并为打印的二级子菜单

    场景 Winforn中实现ZedGraph自定义添加右键菜单项(附源码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10 ...

  7. MATLAB用“fitgmdist”函数拟合高斯混合模型(一维数据)

    MATLAB用“fitgmdist”函数拟合高斯混合模型(一维数据) 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 在MATLAB中“fitgmdis ...

  8. 剑指offer 15.链表反转

    15.链表反转 题目描述 输入一个链表,反转链表后,输出新链表的表头. PHead,pre, next分别指向当前结点, 前一个结点, 后一个结点,每次迭代先更新当前结点的指针,记录下个结点的指向,转 ...

  9. Ubuntu 18.04 怎么安装Gnome Tweak Tool

    地址:https://jingyan.baidu.com/article/86f4a73ebd6c9437d7526963.html 终端键入命令:[sudo add-apt-repository u ...

  10. yii2表单提交CSRF验证

    Yii2表单提交默认需要验证CSRF,如果CSRF验证不通过,则表单提交失败,解决方法如下: 第一种解决办法是关闭Csrf public $enableCsrfValidation = false; ...