1、安装依赖库

yum install readline-devel pcre-devel openssl-devel gcc

2、下载openresty

wget --no-check-certificate https://openresty.org/download/openresty-1.11.2.2.tar.gz

3、解压文件

tar xzvf openresty-1.11.2.2.tar.gz

4、进入解压目录,

cd openresty-1.11.2.2

5、安装在/usr/local/openresty目录

./configure --prefix=/usr/local/openresty

6、make

make

7、make install

make install

8、设置环境变量

vi /etc/profile
加下面代码
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH
让修改的环境变量生效
source /etc/profile 
9、查看版本

nginx -v

如果出现nginx version: openresty/1.11.2.2,则安装成功

10、设置Nginx为服务和开机启动

vi /etc/rc.d/init.d/nginx

#!/bin/bash
# Tengine Startup script# processname: nginx
# chkconfig: -
# description: nginx is a World Wide Web server. It is used to serve
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/openresty/nginx/sbin/nginx
nginx_config=/usr/local/openresty/nginx/conf/nginx.conf
nginx_pid=/usr/local/openresty/nginx/logs/nginx.pid
RETVAL=
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} =
[ -x $nginxd ] || exit
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "tengine already running...."
exit
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL =  ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL =  ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;

status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit
esac
exit $RETVAL

11、保存退出

chmod  /etc/rc.d/init.d/nginx   #赋予文件执行权限
chkconfig  --level  nginx on   #设置开机启动
service nginx start 

centos6安装openresty的更多相关文章

  1. centos6.5 安装openresty

    [1]centos6.5 安装openresty步骤 (1)基础依赖库安装 1.1 yum install pcre-devel openssl-devel gcc curl (2)openResty ...

  2. CentOS6.4 安装OpenResty和Redis 并在Nginx中利用lua简单读取Redis数据

    1.下载OpenResty和Redis OpenResty下载地址:wget http://openresty.org/download/ngx_openresty-1.4.3.6.tar.gz Re ...

  3. CentOS6.9 安装OpenResty

    1.安装依赖包 yum install -y gcc gcc-c++ readline-devel pcre-devel openssl-devel tcl perl 2.安装OpenResty 首先 ...

  4. Centos6 安装vnc

    Centos6 安装vnc 1. 安装 使用yum方式安装 yum install tigervnc-server tigervnc #启动 vncserver #重启动 /etc/init.d/vn ...

  5. centos6 安装vsftpd

    centos6 安装vsftpd vsftpd一般选择yum安装,以下是安装和配置过程 如果是centos6想要安装的话一般是编译安装 1.安装 yum安装 yum install vsftpd 编译 ...

  6. oracle 11g centos6 安装

    选型:32位的内存是个瓶颈,已经是64位的时代了.使用64位的CentOS6 和 64位的Oracle 11g R2在虚拟机器安装,采用hostonly方式设置网络注意:能上网的网卡要设置一下ICS( ...

  7. CentOS6 安装Sendmail + Dovecot + Roundcubemail

    前言 本文是继CentOS6 安装Sendmail + Dovecot + Squirrelmail 关于邮箱服务器配置的第二篇文章,因为关于使用Sendmail进行相关配置的文章.资料等太老,而且资 ...

  8. centos6 安装配置ss笔记

    2018-05-17 centos6 安装配置ss笔记 操作环境:Centos 6 x86_64 bbr 服务器地址:美国 1.准备VPS 在https://www.bwh1.net可购买,购买时已默 ...

  9. Centos6安装Percona-tools工具

    Centos6安装Percona-tools工具 环境:centos6.x yum -y install perl-DBI yum -y install perl-DBD-MySQL yum -y i ...

随机推荐

  1. java web----URL

     简单使用 import java.io.*; import java.net.HttpURLConnection; import java.net.MalformedURLException; im ...

  2. tinymce-vue富文本编辑器(翻译)

    官方Tinymce Vue组件 翻译来自:https://github.com/tinymce/tinymce-vue 官方文档:https://www.tiny.cloud/docs/general ...

  3. 通过iostat来查看linux硬盘IO性能|实例分析

    iostat查看linux硬盘IO性能 rrqm/s: 每秒进行 merge 的读操作数目.即 delta(rmerge)/s wrqm/s: 每秒进行 merge 的写操作数目.即 delta(wm ...

  4. https://www.cnblogs.com/zoro-robin/p/6110188.html

    https://www.cnblogs.com/zoro-robin/p/6110188.html https://blog.csdn.net/kongxx/article/details/65435 ...

  5. 实战--Keepalived和LVS实现负载高可用

    显然,只有上一篇的操作,在WEB运维技术中,只能承担一半的角色. 想像一下,如何LVS本身倒了,肿么办?后端的NGINX再多,也只能是干着急,请求过来不呀! 所以,在本篇时,我们来实现LVS永不倒, ...

  6. 使用SecureCRT脚本备份网络设备配置的一点感悟

    https://blog.csdn.net/qq_25294171/article/details/85158458

  7. webpack学习笔记--压缩代码

    浏览器从服务器访问网页时获取的 JavaScript.CSS 资源都是文本形式的,文件越大网页加载时间越长. 为了提升网页加速速度和减少网络传输流量,可以对这些资源进行压缩. 压缩的方法除了可以通过 ...

  8. NPOI导出Excel帮助类

    工具类 using System; using System.Collections.Generic; using System.Data; using System.IO; using System ...

  9. Maya闪退

    电脑上装的Maya2015突然就打不开了,窗口闪一下就关闭,也没有任何提示. 将15卸载装了Maya2016还是一样. 再彻底卸载16,装了15,还不行... 将系统环境变量中PYTHONHOME和P ...

  10. codeforces 1037

    题解: E-trips 哎哎哎好傻逼啊 没有想到算不能的一直在想怎么算能的 太傻逼了 其实很简单 我们只需要对好友<=k的首先dfs一下给他连接着的朋友-1 然后如果小于了就递归下去 这个正确性 ...