【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
相关推荐
en-route5 小时前
macOS 无法在根目录创建目录的原因与解决方案
macos
csdn_aspnet1 天前
在 MacOS 中安装 MySQL 8
mysql·macos
木兰不吃草1 天前
完美解决在最新系统 MacOS 26 无法使用 playCover 键盘映射的问题(下载安装教程,完美适配)
macos·键盘映射·playcover·mac26
乾坤瞬间2 天前
【Deepseek OCR】重磅测试,mac环境下的体验【本人已经本地实验成功】
macos·ocr
开发者驿站2 天前
2025年保姆级C++环境配置教程(Windows/macOS双平台)
c++·windows·macos
猫头虎2 天前
解决升级IDEA2025.2后,每次打开Maven项目爆红的问题:Windows和Mac解决方案
java·ide·macos·maven·intellij-idea·idea·intellij idea
白玉cfc2 天前
【iOS】KVC 与 KVO 的基本了解与使用
macos·ios·objective-c·cocoa
马拉萨的春天2 天前
谈谈你对iOS的runtime和runloop的了解
macos·ios·cocoa
xingxing_F2 天前
A Better Finder Rename for mac 文件批量重命名
macos