您必须将这些库
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. mysql小白系列_09 mysql性能优化关键点

    一 服务器参数调优,有哪些关键点? 1. 应用访问优化 优化方法 性能提升效果 优化成本 说明 减少数据访问能不访问就不访问-减少磁盘IO 1~1000 低 缓存服务器缓存mysql数据,Redis. ...

  2. codeforce E. Fire背包

    E. Fire time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  3. SICP 题解集合

    1.1(略) 1.2 biwascheme> (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (- 6 2) (- 2 7))) => -0.24666 ...

  4. C语言合法标识符(hud2024)

    输入方式:先输入一个整型,再循环输入带空格的字符串. 思考:整型用scanf_s()输入.大循环输入字符串前用getchar()函数读取缓冲区的字符.然后,输入带空格的字符串就要用”gets_s()“ ...

  5. .NET Core HttpClient+Consul实现服务发现

    简介 随着.NET Core的不断发展与成熟,基于.NET Core实现微服务的解决方案也越来越多.这其中必然需要注册中心,Consul成为了.NET Core实现服务注册与发现的首选.类似的解决方案 ...

  6. 一键部署open***服务

    一键部署超级简单易用的openvpn服务器,支持多证书+多账号[密码]认证 一. 服务器端部署 项目地址:https://github.com/guoew/openvpn-install 1.1. 下 ...

  7. html5学习之路_003

    html布局 使用<div>元素布局 使用<table>元素布局 <div>元素布局 <!DOCTYPE html> <html> < ...

  8. 05 . Python入门值循环语句

    一.Python循环语句 程序一般情况下是按照顺序执行的 编程语言提供了各种控制结构,允许更复杂的执行路径 Python中的循环语句有for和while但没有do while 循环语句允许我们执行一个 ...

  9. 小谢第10问:前端JS下载文件、表格

    对于小型文件及表格下载,一般采用a标签形式 <buttonb @click="downloadTemplate()">模板下载</button> downl ...

  10. ES6-面向对象即类

    简单介绍 在ES6面向对象基本上与java的类实现类似 1 class关键字,构造器和类分开了 1.1 ES5代码如下 <!DOCTYPE html> <html lang=&quo ...