【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
相关推荐
weixin_4624462323 分钟前
使用 pip3 一键卸载当前环境中所有已安装的 Python 包(Linux / macOS / Windows)
linux·python·macos
txinyu的博客15 小时前
MAC 地址
服务器·网络·macos
小胖红16 小时前
Xcode 打包失败 处理
ide·macos·xcode
June bug18 小时前
【实习笔记】客户端基础技术
笔记·macos·cocoa
HiTomcat20 小时前
一键自动化部署 macOS 开发环境
运维·macos·自动化
海棠AI实验室1 天前
第 4 篇:为什么选择 Cloudflare Tunnel——在“无公网 IP + 零端口暴露”前提下,把家里 Mac 变成可交付的线上服务
tcp/ip·macos·智能路由器
TESmart碲视1 天前
Mac多显示器支持:TESmart USB-C KVM(搭载DisplayLink技术)全面解析
macos·计算机外设·音视频·外设·kvm切换器·tesmart
开开心心_Every2 天前
免费窗口置顶小工具:支持多窗口置顶操作
服务器·前端·学习·macos·edge·powerpoint·phpstorm
蜜汁小强2 天前
macOS 上卸载并重新安装HomeBrew
macos
新手村领路人2 天前
macOS 原生自带的缩放功能设置
macos