【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
相关推荐
猫头虎20 小时前
web开发常见问题解决方案大全:502/503 Bad Gateway/Connection reset/504 timed out/400 Bad Request/401 Unauthorized
运维·前端·nginx·http·https·gateway·openresty
未名编程1 天前
Linux / macOS / Windows 一条命令安装 Node.js + npm(极限一行版大全)
linux·macos·node.js
was1721 天前
使用 Mole 进行 macOS 深度清理与系统优化
macos·系统清理·cli 工具
TheMemoryIsLost2 天前
mac系统装docker,不装docker desktop,安装colima
macos·docker·容器
ZAEQgyKFs2 天前
基于RBF神经网络的车速预测模型及其在混动汽车能量管理中的应用研究
openresty
红叶尽染寂绀蓝2 天前
已解决:同一ip下,Mac和Windows同时用vscode连接某个Linux远程服务器后,Mac再次连接时无法正确打开远程文件夹,由于转发设置导致
linux·服务器·windows·vscode·tcp/ip·macos
qq_24218863323 天前
快速搭建跨环境检测服务的步骤
linux·开发语言·windows·python·macos
带娃的IT创业者3 天前
解密OpenClaw系列10-OpenClaw系统要求
人工智能·macos·ios·objective-c·ai智能体·智能体开发·openclaw
Laughtin3 天前
claude code的安装和更新方法(macos)
macos
systeminof3 天前
Mac Studio发货时间明显拉长,或预示苹果新品临近发布
macos