【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
相关推荐
带娃的IT创业者36 分钟前
解密OpenClaw系列07-OpenClaw数据流分析
macos·软件工程·agent·ai智能体·智能体开发·openclaw
春波petal3 小时前
MacOS 13.7.8版本-前端环境一键搭建指南
前端·macos
FJW02081418 小时前
《Nginx 高级应用:变量、Rewrite、反向代理与 OpenResty 扩展》(3)
运维·nginx·openresty
eppen19 小时前
macOS 快捷键修改
macos
郁大锤1 天前
macOS 终端 SSH 到 Linux 后快捷键失效解决方法
linux·macos·ssh
阿捏利1 天前
详解Mach-O(十三)Mach-O __TEXT
macos·ios·c/c++·mach-o
Laughtin1 天前
macos的python安装选择以及homebrew python的安装方法
开发语言·python·macos
猫头虎1 天前
OpenClaw相关的开源AI项目汇总大全:本文涵盖近期所有OpenClaw相关的GitHub高星star热门项目
运维·人工智能·macos·docker·容器·开源·github
eppen1 天前
macos 分屏软件
macos
阿捏利2 天前
详解Mach-O(十四)Mach-O __DATA
macos·ios·c/c++·mach-o