【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
相关推荐
8***84822 小时前
macOs安装docker且在docker上部署nginx+php
nginx·macos·docker
Aurora-silas2 小时前
Mac 本地运行 Hugging Face 大模型完全指南:PyTorch (MPS) vs Apple MLX
人工智能·pytorch·macos
8***84823 小时前
macOS安装Redis
数据库·redis·macos
小镇学者4 小时前
【PHP】macos 系统 git pull 时 报错File name too long问题
git·macos·php
m0_4885732314 小时前
简易编译器C++
macos·objective-c·cocoa
聊天QQ:6882388615 小时前
改进下垂控制的孤岛型并联分布式电源微电网系统
openresty
00后程序员张15 小时前
iOS App 如何上架,从准备到发布的完整流程方法论
android·macos·ios·小程序·uni-app·cocoa·iphone
Ujimatsu15 小时前
AMD锐龙H 255 + 780M核显 虚拟机安装macOS 15 Sequoia(2025.11)(可登录Apple ID)
macos·vmware·虚拟机·amd·sequoia·h 255
benxin123415 小时前
macOS 上使用 Homebrew 安装和配置 PostgreSQL 的详细步骤
macos·postgresql·策略模式
他们都不看好你,偏偏你最不争气15 小时前
【iOS】TableView的优化
macos·ios·objective-c·cocoa