【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
相关推荐
只会写bug的靓仔9 小时前
mac 设置飞书默认浏览器(解决系统设置默认浏览器无效)
macos·飞书
尽兴-1 天前
Mac「brew」快速安装Redis
数据库·redis·macos·brew
尽兴-1 天前
Mac 「brew」快速安装MySQL
mysql·macos·adb·brew
明似水1 天前
macOS 更新后找不到钥匙串访问工具的解决方案
macos
一牛1 天前
Appkit: 菜单是如何工作的
macos·ios·objective-c
tkevinjd1 天前
文件操作、流对象示例
macos·objective-c·cocoa
古月的三个锦囊1 天前
Nginx openresty web服务 与 Go 原生web服务性能对比
nginx·go·openresty
Dachui_11222 天前
MacOS上如何运行内网穿透详细教程
macos
Bruce_Liuxiaowei2 天前
使用Python脚本在Mac上彻底清除Chrome浏览历史:开发实战与隐私保护指南
chrome·python·macos
iFlyCai3 天前
对Mac文字双击或三击鼠标左键没有任何反应
macos·计算机外设