首页 > 系统相关 >通过yum安装Openresty

通过yum安装Openresty

时间:2023-07-24 13:47:55浏览次数:30  
标签:status Openresty reload local nginx yum usr openresty 安装

Openresty官网:http://openresty.org/cn/

1、下载yum-utils

yum install yum-utils -y

2、添加openresty的repo

yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
安装Openresty
yum install openresty -y

安装后,查看一下版本号

resty -V

可以看到默认路径和nginx的路径

默认安装在/usr/local/openresty下

3、添加环境变量
PATH=/usr/local/openresty/nginx/sbin:$PATH
export PATH

4、查看
nginx -V

 

 5、编写启动脚本

注意默认路径为:/usr/local/openresty下

如果源码安装时修改了路径,这里的脚本也要修改成对应的路径

vim /etc/init.d/openresty

#!/bin/sh
#
# openresty - this script starts and stops the openresty daemin
#
# chkconfig: - 85 15
# description: OpenResty is a full-fledged web platform that integrates \
# the standard Nginx core, LuaJIT, many carefully written Lua libraries, \
# lots of high quality 3rd-party Nginx modules, and most of their external dependencies.
# processname: openresty
# config: /usr/local/openresty/nginx/conf/nginx.conf
# pidfile: /usr/local/openresty/nginx/logs/nginx.pid
# Last Updated 2018.07.15

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/openresty/nginx/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/openresty/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/openresty/nginx/logs/nginx.pid"

[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
#service php-fpm start
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
$nginx -s stop
echo_success
retval=$?
echo
#service php-fpm stop
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
stop
start
}

reload() {
configtest || return $?
echo -n $"Reloading $prog: "
$nginx -s reload
RETVAL=$?
echo
}

force_reload() {
restart
}

configtest() {
$nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac


6、给执行权限
chmod +x /etc/init.d/openresty

7、启动
systemctl start openresty

8、查看状态
systemctl status openresty

9、开机自启
systemctl enable openresty

10、访问openresty

http://localhost

默认是80端口,可以修改端口号在/usr/local/openresty/nginx/conf/nginx.conf修改即可
和修改nginx的配置一样

 

标签:status,Openresty,reload,local,nginx,yum,usr,openresty,安装
From: https://www.cnblogs.com/likecoke/p/17576985.html

相关文章

  • 给服务器安装系统点滴
    给公司测试服务器升级操作系统颇为周折,以前一帆风顺的操作,反复的折腾了几日,特记录下来;(服务器硬盘分区格式为MBR)一开始想用工具Ventoy制作一个多系统安装U盘,按使用说明设置分区类型为MBR,将操作系统复制到U盘根目录下;但实际安装过程中并不能友好的自动进行,进行到选择分区时,直接提......
  • 1.Docker基础及自动安装
    docker的介绍和基础操作docker单机容器dockercompose单机多个容器k8s多机多个容器container即容器,集装箱docker就是搬运集装的码头工人,管理容器的管理工具Docker的组成:Docker主机(Host):一个物理机或虚拟机,用于运行Docker服务进程和容器,也称为宿主机,node节点Docker......
  • 在android虚拟机中安装app
    在Android虚拟机中安装App在Android开发中,我们经常需要在虚拟机中安装App以进行调试和测试。本文将介绍如何在Android虚拟机中安装App,并提供代码示例。创建虚拟机首先,我们需要创建一个Android虚拟机。可以使用AndroidStudio提供的虚拟设备管理器来创建和管理虚拟机。以下是创建......
  • 设置pip的安装源
    windows一般有两个位置C:\Users\<YourUsername>\.pip\pip.iniC:\Users\<YourUsername>\AppData\Roaming\pip\pip.inilinux/etc/pip.conf~/.pip/pip.conf~/.pip.conf内容[global]timeout=6000index-url=http://pypi.douban.com:80/simple/trust......
  • jadx安装与配置,hook框架frida
    jadx1.下载jadx反编译工具,安装(解压即用)#下载地址:https://github.com/skylot/jadx/releases2.打开jadx反编译工具:3.抓包与代码定位3.1抓包#1.安装apk#2.打开chaarles,打开app,定位到登录请求3.2.反编译定位代码的位置#抓包#想去反编译代码中的位置......
  • finalShell的安装和使用
    finalshell的下载链接:https://pan.baidu.com/s/17D7oZ3xo24lnmFJ_amXdBA提取码:86ym1、finalshell的安装安装步骤很简单,下一步,下一步,安装完即可,存放路径,建议不要存放在c盘2、操作步骤2.1打开工具 2.2 修改快捷键 获取结束之后,点击确认使用以上方式,将系统原来默认......
  • linux安装源码包指定安装目录【转载】
    本文来自博客园,作者:阿弱,转载请注明原文链接:https://www.cnblogs.com/aruo/p/15771915.html当下载完一个源码包并且解压后文件夹下会有一个重要的文件configureconfigure文件是一个可执行的脚本文件,它将检查目标系统的配置和可用功能,比如一些检查依赖或者启用禁用一些模块,它有......
  • 如何在Windows中安装WinCC V8.0
    通常SIMATICWinCC的产品包装中包含三张光盘。以WinCCV8.0为例,分别是WinCCV8.0、SIMATICNETV18和additionalContent。其中,WinCCV8.0是基本的安装包,SIMATICNETV18提供了通讯所必须的驱动程序,AdditionalContent中提供了SQLSERVER的管理工具。安装时需要注......
  • centos7 安装 minio RELEASE.2021-06-17
    1、下载执行包wgethttps://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2021-06-17T00-10-46Z2、创建数据、日志文件夹mkdir-p/data/project/minio/data/mkdir-p/data/project/minio/log/touch/data/project/minio/log/minio.log3、授......
  • 在Centos7安装Mongodb
    背景为了创建一个关于nodejs项目,选取mongodb作为数据库使用。WindowsC盘还剩1GB,于是决定装到Centos7服务器上。安装下载安装包:https://www.mongodb.com/try/download/community-kubernetes-operator拖拽安装包:解压缩:tar-zxvfmongodb-linux-x86_64-rhel70-6.0.8.tgz......