【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
相关推荐
旭日跑马踏云飞28 分钟前
【macOS】相关
macos
lichao89042717 小时前
MacOS 上部署 OpenClaw 的全界面操作方案
macos·docker·容器
美酒没故事°1 天前
mac电脑安装OpenClaw步骤
人工智能·macos
开发者导航3 天前
【开发者导航】多功能生成模型开发工具:Diffusers 详细介绍
人工智能·python·学习·macos·信息可视化
猫头虎4 天前
web开发常见问题解决方案大全:502/503 Bad Gateway/Connection reset/504 timed out/400 Bad Request/401 Unauthorized
运维·前端·nginx·http·https·gateway·openresty
未名编程4 天前
Linux / macOS / Windows 一条命令安装 Node.js + npm(极限一行版大全)
linux·macos·node.js
was1724 天前
使用 Mole 进行 macOS 深度清理与系统优化
macos·系统清理·cli 工具
TheMemoryIsLost4 天前
mac系统装docker,不装docker desktop,安装colima
macos·docker·容器