您必须将这些库
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. 14.4 Go Xorm

    14.4 Go Xorm 获取xorm go get -u -v github.com/go-xorm/xorm xorm增删改查 /** * 应用程序 * 同目录下多文件引用的问题解决方法: * h ...

  2. iozone测试报错:Error writing block 12634, fd= 3 write: No space left on device

    问题:使用iozone测试GFS的读写性能的时候,一直报错Error writing block 12634, fd= 3 write: No space left on device,百思不得其解: ...

  3. poj2112 网络流+二分答案

    Optimal Milking Time Limit: 2000MS   Memory Limit: 30000K Total Submissions: 18083   Accepted: 6460 ...

  4. 安装依赖jdk---linux

    1,下载JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2,使用XFTP ...

  5. HDFS设计思想、元数据、简单JAVAAPI操作HDFS

    一. 设计思路 分布式文件系统 在Hadoop中文件系统是一个顶层的抽象. 分布式文件系统相当与对文件系统进行了一个扩展(类似于java中的接口). HDFS是分布式文件系统的一个实现,分布式文件系统 ...

  6. 在Cent OS云服务器上部署基于TP5后端代码踩坑记录_艾孜尔江撰

    推荐使用镜像安装Cent OS系统,或者在纯净安装完成之后在完成Apache+MySQL+PHP的时候不要每个单独安装,因为这样会出一些三者之间版本不配的问题,网上各种说法都有,查起来也非常困难,版本 ...

  7. 基于Hadoop不同版本搭建hive集群(附配置文件)

    本教程采用了两种方案 一种是hive-1.21版本,hadoop版本为hadoop2.6.5 还有一种是主要讲基于hadoop3.x hive的搭建 先来第一种 一.本地方式(内嵌derby) 步骤 ...

  8. debug PHP程序(xdebug、IntelliJ IDEA)

    之前写PHP程序的都是echo调试,今天感觉太麻烦了就想起研究一下IntelliJ IDEA如何调试PHP程序. 从网上查找了很多资料,大部分都提到在IDE里开启服务,一下就懵了,怎么启这么多服务呢. ...

  9. Python之TestLink篇

    如何让时间变慢? 你们不知道吧,这个时候翻开书,时间又变慢了一倍,可以这样延年益寿,哈哈哈 ------------------------------------------------------ ...

  10. Redis详解(十一)------ 过期删除策略和内存淘汰策略

    在介绍这篇文章之前,我们先来看如下几个问题: ①.如何设置Redis键的过期时间? ②.设置完一个键的过期时间后,到了这个时间,这个键还能获取到么?假如获取不到那这个键还占据着内存吗? ③.如何设置R ...