【MAC】OpenResty安装

首先官方网站:http://openresty.org/cn/download.html

安装:

我是安装官网去执行的安装命令

配置环境变量

powershell 复制代码
1.打开配置文件
vim ~/.bash_profile

2.粘贴进去变量配置
#OPENRESTY
export NGINX_HOME=/opt/homebrew/etc/openresty
export PATH=$PATH:$NGINX_HOME/sbin

3.刷新配置
source ~/.bash_profile

测试1

powershell 复制代码
查看是否安装成功:
nginx -v
openresty -v

测试2

在nginx.conf配置中加入下面代码

powershell 复制代码
  server {
        #监听端口,若你的6699端口已经被占用,则需要修改
        listen 6699;
    server_name localhost;
        location / {
            default_type text/html;

            content_by_lua_block {
                ngx.say("HelloWorld")
            }
        }
    }

启动和关闭

powershell 复制代码
openResty的启动和停止:(要在配置文件目录下)

启动:openresty -p `pwd` -c nginx.conf 

停止:openresty -s quit -p `pwd` -c nginx.conf
相关推荐
tobebetter95276 小时前
How to use homebrew on mac
macos·homebrew
maycho1236 小时前
探索 IEEE33 节点配电网模型:MATLAB 中的潮流与故障仿真之旅
openresty
雨落秋垣7 小时前
优化 OpenResty 的性能
junit·openresty
信奥胡老师17 小时前
苹果电脑(mac系统)安装vscode与配置c++环境,并可以使用万能头文件全流程
c++·ide·vscode·macos·编辑器
记忆偶然1 天前
语音转文本技术方案评估与工具选型指南
ide·macos·xcode
尽兴-1 天前
MacOS 一键清理指定目录下老旧node_modules
macos
嗝屁小孩纸2 天前
利用OpenResty统计网站访问量
junit·openresty
雾蓝回针2 天前
[全网首发]解决Parallels Desktop运行“第五人格“时 使用涂鸦/快捷发言会导致视角偏移的问题
笔记·macos
这儿有一堆花2 天前
视频文件的技术逻辑解析
windows·macos
Sheffi662 天前
iOS Crash 本质与捕获修复方案
macos·ios·cocoa