openresty——yum安装 配置 使用 错误处理 docker方式安装
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方式安装的更多相关文章
- Reporting Service服务SharePoint集成模式安装配置(3、4、安装sharepoint 2010必备组件及产品)
Reporting Service服务SharePoint集成模式安装配置 第三步和第四部 第三步 安装sharepoint 2010必备组件 1.安装SharePoint2010必备组件,执行Pre ...
- 在CentOS上通过Docker方式安装Redis
在CentOS上通过Docker方式安装Redis 首先保证已经安装docker. 拖拽redis镜像 docker pull redis 启动redis docker run -p 6379:637 ...
- docker方式安装zabbix
这个示例展现了如何运行支持MySQL数据库的Zabbix server,基于Nginx web服务器运行Zabbix web接口,以及Zabbix Java gateway. 1. 启动一个空的MyS ...
- Windows下VMware虚拟机使用Centos,Docker方式安装openstf的小坑
今天使用docker方式安装openstf碰到了一小坑,坑了我半天.特此记录! docker方式安装stf就不说了,网上教程一大把. 但是... 安装完之后.进入web控制界面,手机连接的好好的.但硕 ...
- Linux上通过docker方式安装mysql
centos版本信息: docker版本信息 mysql版本:5.7 1.docker方式安装 首先拉取mysql镜像:docker pull mysql:5.7 查看本地的mysql镜像 执 ...
- 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 ...
- linux经常使用(一)linux 安装配置 jdk之 找不到安装文件文件夹及source /etc/profile 报unexpected end of file 错误 解决
linux 安装配置 jdk 应该算是一个非常主要的东西.可是我到如今才自己第一次 正式安装.果然出现了问题.. 问题就是 安装之后 找不到 安装路径 ,进而没法配置环境变量. 现象例如以下: 提示 ...
- 2018超详细sublime text3+python3.x安装配置教程(附常用插件安装教程)
导读 本文是关于2018年7月最新版sublime text3+pythin3.x下载及安装配置教程,sublime text3版本为3176,python版本为3.7,安装环境是基于windows1 ...
- pipelinewise 学习一 docker方式安装
pipelinewise 没有提供基于pip 包的模式进行安装,而且推荐使用docker 以及源码的方式 以下是一个使用docker运行的方式 安装 git clone https://githu ...
随机推荐
- 学习Qt Charts - Qt Charts的坐标轴
这次来学学Qt chart 的坐标轴 有这么一组数据: 这是深圳市2019年6月份的天气预报(来自中国天气网:深圳),里面有每天的最高温度,把这最高温度做成个数组,如下: int daily_temp ...
- JUL 日志框架
1.JUL 简介 JUL 全称 Java Util Logging,位于java.util.logging.Logger 包.它是 java 原生的日志框架,使用时无需另外引用第三方的类库,相对其他的 ...
- Kubernetes全栈架构师(Kubeadm高可用安装k8s集群)--学习笔记
目录 k8s高可用架构解析 Kubeadm基本环境配置 Kubeadm系统及内核升级 Kubeadm基本组件安装 Kubeadm高可用组件安装 Kubeadm集群初始化 高可用Master及Token ...
- 使用了gitlab管理pipeline,Jenkinsfile 中在出现克隆命令流水线执行会混乱
Jenkins_pipeline关闭默认检出 问题描述 在使用 Pipeline(流水线)过程中,如果使用了(Pipeline script from SCM)远程 Git 的 Jenkinsfile ...
- 资源:Hadoop安装包下载路径
下载路径 Hadoop所有版本:http://archive.apache.org/dist/hadoop/common/
- mybatis源码简单分析
mybatis入门介绍 /** * 1. 接口式编程 * 原生: Dao =====> DaoImpl * mybatis : Mapper =====> xxxMapper * 2. S ...
- mybatis 批量新增-批量修改-批量删除操作
mapper.xml <!-- 批量新增 --> <insert id="saveBatch" parameterType="java.util.Lis ...
- Leetcode No.122 Best Time to Buy and Sell Stock II Easy(c++实现)
1. 题目 1.1 英文题目 You are given an array prices where prices[i] is the price of a given stock on the it ...
- HAl库控制L298N直流电机旋转笔记
主函数开始后的处理流程: 1..所有外设初始化:HAL_Init() 2.系统时钟配置 RCC振荡器初始化:HAL_RCC_OsConfig() RCC时钟初始化:HAL_RCC_ClockConfi ...
- 前端-HTML基础+CSS基础
.pg-header { height: 48px; text-align: center; line-height: 48px; background-color: rgba(127, 255, 2 ...