yum方式安装

wget https://openresty.org/package/centos/openresty.repo

mv openresty.repo /etc/yum.repos.d/

ll /etc/yum.repos.d/

yum list | grep openresty

yum install -y openresty.x86_64

service openresty status

service openresty start

/usr/local/openresty/nginx/sbin/nginx -v

vim /usr/local/openresty/nginx/conf/nginx.conf

/usr/local/openresty/nginx/sbin/nginx -s reload

支持lua 配置文件添加

 #lua 缓存(每次修改lua后需要重启)默认是开启 on , 开发阶段建议关闭,生产环境必须开启
lua_code_cache on;
lua_package_path "/root/data/acgn/game_res/?.lua;/root/data/acgn/game_res/script/?.lua;/root/data/acgn/game_res/serverbattle/src/?.lua;;"; #lua 模块
server {
listen 8009;
server_name localhost; client_max_body_size 50m;
client_body_buffer_size 10m; location /battle_callback {
default_type text/plain;
content_by_lua_file /root/data/acgn/game_res/blaze_battle.lua;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

报错

tail -f /usr/local/openresty/nginx/logs/error.log

tail -f /usr/local/openresty/nginx/logs/error.log
2021/05/26 17:19:14 [error] 83655#83655: *6 failed to load external Lua file "/root/data/acgn/game_res/blaze_battle.lua": cannot open /root/data/acgn/game_res/blaze_battle.lua: Permission denied, client: 192.168.1.51, server: localhost, request: "GET /battle_callback HTTP/1.1", host: "192.168.1.20:8009"
2021/05/26 17:19:26 [error] 83655#83655: *7 failed to load external Lua file "/root/data/acgn/game_res/blaze_battle.lua": cannot open /root/data/acgn/game_res/blaze_battle.lua: Permission denied, client: 192.168.1.51, server: localhost, request: "POST /battle_callback HTTP/1.1", host: "192.168.1.20:8009"

原因: nginx进程所属用户nobody

[root@bogon acgn]# ps -ef | grep nginx
root 15795 1 0 May25 ? 00:00:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx
nobody 83709 15795 0 17:19 ? 00:00:00 nginx: worker process
root 83736 36201 0 17:20 pts/0 00:00:00 grep --color=auto nginx

vim /usr/local/openresty/nginx/conf/nginx.conf

把 user nobody 改为 user root

/usr/local/openresty/nginx/sbin/nginx -s reload

解决。

下面是docker方式安装

1、拉取镜像

docker images
docker pull openresty/openresty:1.19.3.1-centos7

2、先启动一个作出配置文件

docker run -d --name openresty \
-p 8009:8009 \
openresty/openresty:1.19.3.1-centos7
做目录
tree /root/data/soft/openresty
/root/data/soft/openresty
├── conf
├── logs
└── lua
docker cp openresty:/usr/local/openresty/nginx/conf/nginx.conf /root/data/soft/openresty/conf/

3、删除旧容器

docker stop openresty
docker rm openresty
docker ps -a

4、启动 指定nginx.conf  lua路径  logs路径

lua_code_cache on;
lua_package_path "/lua/acgn/game_res/?.lua;/lua/acgn/game_res/script/?.lua;lua/acgn/game_res/serverbattle/src/?.lua;;"; #lua 模块
server {
listen 8009;
server_name localhost; client_max_body_size 50m;
client_body_buffer_size 10m; location /battle_callback {
default_type text/plain;
content_by_lua_file /lua/acgn/game_res/blaze_battle.lua;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

6、重新加载配置或者重启openresty

docker exec -it openresty nginx -s reload
修改容器所占最大内存
docker update -m 1G --memory-swap 1G openresty

7、下面是HAProxy负载均衡配置

在三台机器  192.168.1.20   192.168.1.21  192.168.1.22 各部署一个openresty,用HAProxy作负载均衡

vim /etc/haproxy/haproxy.cfg

#openresty for battle check
listen acgn_battle
bind 0.0.0.0:8008
mode http
balance roundrobin
server battle1 192.168.1.20:8009
server battle2 192.168.1.21:8009
server battle3 192.168.1.22:8009

service haproxy restart

service haproxy status

openresty——yum安装 配置 使用 错误处理 docker方式安装的更多相关文章

  1. Reporting Service服务SharePoint集成模式安装配置(3、4、安装sharepoint 2010必备组件及产品)

    Reporting Service服务SharePoint集成模式安装配置 第三步和第四部 第三步 安装sharepoint 2010必备组件 1.安装SharePoint2010必备组件,执行Pre ...

  2. 在CentOS上通过Docker方式安装Redis

    在CentOS上通过Docker方式安装Redis 首先保证已经安装docker. 拖拽redis镜像 docker pull redis 启动redis docker run -p 6379:637 ...

  3. docker方式安装zabbix

    这个示例展现了如何运行支持MySQL数据库的Zabbix server,基于Nginx web服务器运行Zabbix web接口,以及Zabbix Java gateway. 1. 启动一个空的MyS ...

  4. Windows下VMware虚拟机使用Centos,Docker方式安装openstf的小坑

    今天使用docker方式安装openstf碰到了一小坑,坑了我半天.特此记录! docker方式安装stf就不说了,网上教程一大把. 但是... 安装完之后.进入web控制界面,手机连接的好好的.但硕 ...

  5. Linux上通过docker方式安装mysql

    centos版本信息: docker版本信息 mysql版本:5.7 1.docker方式安装 首先拉取mysql镜像:docker pull mysql:5.7     查看本地的mysql镜像 执 ...

  6. 2013最新版Subversion 1.7.10 for Windows x86 + Apache 2.4.4 x64 安装配置教程+错误解决方案

    一 .工作环境 操作系统:Windows Server 2008 R2 SP1 x64 Apache版本:2.4.4 Subversion版本: Setup-Subversion-1.7.10.msi ...

  7. linux经常使用(一)linux 安装配置 jdk之 找不到安装文件文件夹及source /etc/profile 报unexpected end of file 错误 解决

    linux 安装配置 jdk 应该算是一个非常主要的东西.可是我到如今才自己第一次 正式安装.果然出现了问题.. 问题就是 安装之后 找不到 安装路径 ,进而没法配置环境变量. 现象例如以下: 提示 ...

  8. 2018超详细sublime text3+python3.x安装配置教程(附常用插件安装教程)

    导读 本文是关于2018年7月最新版sublime text3+pythin3.x下载及安装配置教程,sublime text3版本为3176,python版本为3.7,安装环境是基于windows1 ...

  9. pipelinewise 学习一 docker方式安装

    pipelinewise 没有提供基于pip 包的模式进行安装,而且推荐使用docker 以及源码的方式 以下是一个使用docker运行的方式 安装   git clone https://githu ...

随机推荐

  1. 小程序动态修改页面标题setNavigationBarTitle

    可以使用setNavigationBarTitle方法动态设置页面标题 wx.setNavigationBarTitle({ title: options.name, })

  2. POJ 3984 迷宫(BFS)

    入门BFS,第一次做,部分借鉴了大牛的 #include <iostream> #include <cstdio> #include <queue> using n ...

  3. 【译】Go:程序如何恢复?

    原文:https://medium.com/a-journey-with-go/go-how-does-a-program-recover-fbbbf27cc31e ​ 当程序不能正确处理错误时, 会 ...

  4. AcWing 341. 最优贸易

    C国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市. 任意两个城市之间最多只有一条道路直接相连. 这 m 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的 ...

  5. Source not found for GeneratedMethodAccessor127.invoke(Object, Object[]) line: not available

    报错:Source not found for GeneratedMethodAccessor127.invoke(Object, Object[]) line: not available 我在使用 ...

  6. 链表逆序---python

    class ListNode: Value = '' # 节点要储存的值,因为Python是弱类型,因此无需传入泛型 Next = None # 下一个节点,初始化时为空值 def __init__( ...

  7. 全彩LED灯

    1.全彩 LED 灯,实质上是一种把红.绿.蓝单色发光体集成到小面积区域中的 LED 灯,控制时对这三种颜色的灯管输出不同的光照强度,即可混合得到不同的颜色,其混色原理与光的三原色混合原理一致.例如, ...

  8. 高校表白App-团队冲刺第九天

    今天要做什么 在Fragment首页加上轮转播报,点击图片进入相应连接 做了什么 功能实现,通过连接第三方库来进行实现,比较简单.(url就可以) 遇到的问题 在调用以前的工具类时,有点小问题,发现以 ...

  9. final修饰符(2)

    final局部变量 系统不会对局部变量进行初始化,局部变量必须又程序员显示初始化,因此使用final修饰局部变量,可以在声明时指定默认值,也可以在后面的代码中对该final变量赋初始值,但只能赋值一次 ...

  10. ffmpeg入门篇-滤镜的基本使用

    转发自白狼栈:查看原文 滤镜 什么是滤镜?百度百科介绍说"滤镜主要是用来实现图像的各种特殊效果......". 我们最早在ffmpeg是如何转码的一文中了解过滤镜,来回顾下当时的转 ...