您必须将这些库
perl 5.6.1+
libreadline
libpcre
libssl
安装在您的电脑之中。

对于 Linux来说, 您需要确认使用 ldconfig 命令,让其在您的系统环境路径中能找到它们。

CentOS 7 安装OpenResty所需依赖:

[root@snails ~]# yum -y install readline-devel pcre-devel openssl-devel gcc

下载:

[root@snails ~]# wget https://openresty.org/download/openresty-VERSION.tar.gz

[root@snails ~]# tar xzvf ngx_openresty-VERSION.tar.gz

编译安装:

然后在进入 ngx_openresty-VERSION/
目录, 然后输入以下命令配置:
./configure --prefix=/root/openresty

默认, --prefix=/usr/local/openresty
程序会被安装到/usr/local/openresty目录。

./configure \
--with-http_ssl_module \
--with-zlib=/root/zlib-1.2.8 \   #源码路径
--with-http_gzip_static_module \
--with-pcre=/root/pcre-8.39 \
--with-pcre-jit \
--with-http_flv_module \
--with-http_sub_module \
--with-http_stub_status_module \
--with-openssl=/root/openssl-1.0.2j \
--with-http_gunzip_module \

gmake

gmake install

make -j 4 && make install

试着使用 ./configure --help 查看更多的选项。

设置环境变量及文件软链接:

[root@snails ~]# ln -s /usr/local/openresty/nginx /usr/local/nginx
[root@snails ~]# vi /etc/profile
  export ORPATH=/usr/local/openresty
  export PATH=$PATH:$ORPATH/bin:$ORPATH/nginx/sbin
 

配置用户及组:

[root@snails nginx]# groupadd -f www
[root@snails nginx]# useradd -r -s /sbin/nologin -g www www
[root@snails nginx]# vi conf/nginx.conf user www www;

验证:

[root@snails nginx]# nginx

[root@snails nginx]# curl -I localhost

HTTP/1.1 200 OK

Nginx开机自动启动脚本:

/usr/lib/systemd/system/nginx.service

[root@snails nginx]# cat >> /usr/lib/systemd/system/nginx.service  << EOF
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target   
 
[Service]
Type=forking
PIDFile=/usr/local/nginx/log/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true   
 
[Install]
WantedBy=multi-user.target
 
EOF
 
配置开机服务项:
[root@snails src]# systemctl status nginx
 
[root@snails src]# systemctl enable nginx
 
[root@snails src]# systemctl start nginx
 
[root@snails src]# systemctl reload nginx

在CentOS7上源码安装OpenResty的更多相关文章

  1. 国产化设备鲲鹏CentOS7上源码安装Python3.7

    具体编译过成与正常的Python源代码在x86平台上的过程无异,此篇随笔仅当用作复制黏贴的备忘录.不得不说在一个老旧系统上安装一个老旧的Python版本,从头编译一个Python还是一个较为稳健的选择 ...

  2. centos7上源码安装mysql5.7.11

    由于初学,安装这玩意搞了三天,其间各种报错难以解决,网上各种解答误导.最好的办法还是使用官方的英文文档,建议初学者一定要使用官方的文档,特别是下面两个页面作为初学者一定要细看: Installing ...

  3. 在CentOS7上源码安装php7--Install php7 from source on CentOS7

    首先下载php源码包并解压: # wget http://cn2.php.net/get/php-7.0.9.tar.gz/from/this/mirror # .tar.gz # cd php- 然 ...

  4. 在 Ubuntu 上使用源码安装 OpenResty

    镜像下载.域名解析.时间同步请点击 阿里云开源镜像站 本文将介绍如何在 Ubuntu 上使用源码安装 OpenResty. 目标 Ubuntu 18.04 OpenResty 1.19.3.2 安装依 ...

  5. CentOS7 实战源码安装mysql5.7.17数据库服务器

    CentOS7 实战源码安装mysql5.7.17数据库服务器 简介:实战演练mysql数据库服务器的搭建  mysql简介: mysql是一个开源的关系型数据库管理系统,现在是oracle公司旗下的 ...

  6. [原创]在Centos7.2上源码安装PHP、Nginx、Zentao禅道

    版本 操作系统:CentOS Linux release 7.2.1511 (Core) PHP:5.6.33 Nginx:1.12.2 MySQL:5.6.38(192.168.1.103的Wind ...

  7. CentOS7下源码安装mysql5.6

    目录 准备工作 运行环境 确认你的安装版本 下载mysql 安装mysql 准备安装环境 编译和安装 配置mysql 单实例配置      单实例配置方法          添加防火墙         ...

  8. CentOS7下源码安装5.6.23

    清理CentOS7下的MariaDB. [root@localhost ~]#rpm -qa | gremp mariadb     [root@localhost ~]# rpm -e --node ...

  9. centos7 中源码安装nginx

    使用nginx有一段时间了,还是有很多东西不懂的,在这里做一下自己学习过程中的一些整理,能使自己得到提升. 1.环境:centos7 1511  最小化安装 2.下载nginx,可以在系统中下载,也可 ...

随机推荐

  1. k8s搭建实操记录一(master)

    #1)关闭CentOS7自带的防火墙服务 systemctl disable firewalld systemctl stop firewalld swapoff  -a     ##虚拟机要关闭交换 ...

  2. 牛客网挑战赛19 B,C,F

    链接:https://www.nowcoder.com/acm/contest/131/B来源:牛客网 矩阵 M 包含 R 行 C 列,第 i 行第 j 列的值为 Mi,j. 请寻找一个子矩阵,使得这 ...

  3. Java——反射三种方式的效率对比

    转载自:https://blog.csdn.net/aitcax/article/details/52694423 1 使用field(效率最高)             long start = S ...

  4. nodejs链接mysql 中的问题

    首先你得对mysql ,有个大概的认识. 比如说:如何安装,使用基本的语法,测试安装是否能成功,以及成功之后简单的对于数据库的,操作(增删改查)... 下面是业务场景:在爬虫过程中,租后需要将信息输出 ...

  5. Oracle阻塞会话源头查找-单机和RAC环境

    在写 Oracle session相关数据字典(一)  这篇文章时,提到使用v$session视图的树形查询可以得到Oracle锁树,这样就便于我们找出阻塞会话的源头,但是仅仅可以在单机环境中使用.今 ...

  6. Linux学习(一):常用命令

    init 0:关机 init 3:命令行模式 init 5:图形界面模式 init 6:重启 shutdown -h now:立马关机 ls:文件列表 参数:-l 详细列表 cd:切换目录 用法实例: ...

  7. [Objective-C] 004_继承封装与多态

    继承 面向对象编程 (OOP) 语言的一个主要功能就是"继承".继承是指这样一种能力:它可以使用现有类的所有功能,并在无需重新编写原来的类的情况下对这些功能进行扩展.通过继承创建的 ...

  8. MongoDB学习(一) 安装与基本使用

    链接:https://pan.baidu.com/s/1ogTDFJg3ZZc0CyzaTeswWg 提取码:2k0p 安装 // 将压缩包解压到指定目录 [bigdata@linux backup] ...

  9. 【Flume】安装与测试

    1.下载安装包http://archive.apache.org/dist/flume/ 2.解压命令tar -zxvf 压缩包 -C 路径 3.配置环境变量 export FLUME_HOME=/o ...

  10. SpringBoot学习笔记(十五:OAuth2 )

    @ 目录 一.OAuth 简介 1.什么是OAuth 2.OAuth 角色 3.OAuth 授权流程 4.OAuth授权模式 4.1.授权码 4.2.隐藏式 4.3.密码式 4.4.凭证式 二.实践 ...