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. js笔记13

    1.js操作css样式 div.style.width="100px".在div标签内我们添加了一个style属性,并设定了width值,这种写法会给标签带来大量的style属性, ...

  2. 关于使用Flex中图片处理

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  3. C# 小知识点记录

    1.当计算数据有小数点时不要使用float和double类型的数据,使用这两个会计算不准确.使用decimal 2.如果使用decimal计算数据,遇到除不进的数据有很多小数点的时候,在计算结果后面接 ...

  4. Docker:Docker部署mysql数据库

    docker部署mysql : 8.0 1.在宿主机创建mysql挂载目录 #创建目录 mkdir /home/mysql/conf mkdir /home/mysql/logs mkdir /hom ...

  5. leetcode 字符串转换整数 (模拟)

    思路分析 1.跟着题意模拟,分成几种情况来看待 2.一种全是空格 3.有可能有空格,然后有符号的 4.有可能有空格,无符号数字 5.有可能有空格,非数字开头 6.最后还需要考虑一个越界的问题,所以要除 ...

  6. Spring Cloud中的注解

    一.Eureka @EnableEurekaServer: @EnableDiscoverClient:标注服务是一个Eureka的客户端 @LoadBalanced:自动构造LoadBalancer ...

  7. HTTP工作过程(浏览器输入URL到返回HTML页面都经历了什么)

    超文本传送协议(HyperText Transport Protocol,HTTP)是互联网上应用最为广泛的一种网络协议,它工作在应用层,使用TCP的80号端口提供服务.并且HTTP是工作在客户/服务 ...

  8. dev c++处理汉字

    工具--编译选项--编译器 在连接器命令行加入以下命令 -static-libgcc  -finput-charset=GBK  -fexec-charset=GBK 有些处理汉字的程序运行正常,但E ...

  9. Anaconda3中的python安装新模块

    1.确认安装位置:D:\Anaconda3 2.进入: D:\Anaconda3\Scripts 3.pip install -i https://pypi.tuna.tsinghua.edu.cn/ ...

  10. 1.在配置XML文件时出现reference file contains errors (http://www.springframework.org/schema/beans/...解决方案

    解决方案: 第一步:将 Preferences > XML > XML Files > Validation中"Honour all XML schema location ...