【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
相关推荐
爱吃香蕉的阿豪1 小时前
Mac 远程操作 Windows 开发:ZeroTier + JetBrains 实战指南
windows·macos·zerotoer
大嘴皮猴儿17 小时前
从零开始学商品图翻译:小白也能快速掌握的多语言文字处理与上架技巧
大数据·ide·人工智能·macos·新媒体运营·xcode·自动翻译
空中海19 小时前
第六章:iOS导航与路由系统
macos·ios·cocoa
空中海19 小时前
第九章:iOS系统框架与能力
macos·ios·cocoa
大棉花哥哥20 小时前
MAC下JADX+MCP+OpenCode自动APK逆向分析
macos·ai
空中海21 小时前
第八章:iOS并发编程
macos·ios·cocoa
算是难了21 小时前
macOS常用终端命令
macos
小码过河.1 天前
本地端侧GUI智能体自动化操作电脑Mano-P:macOS版本安装与使用全指南
macos·ai·自动化
空中海1 天前
第十章:iOS架构设计与工程化
macos·ios·cocoa
香蕉鼠片1 天前
跨平台开发到底是什么
linux·windows·macos