【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
相关推荐
怎么没有名字注册了啊3 小时前
(Mac)Visual Studio Code 配置 C/C++运行环境
c++·vscode·macos
耘田3 小时前
一块移动硬盘支持Mac备份和通用文件存储
macos
杂货铺的小掌柜1 天前
MAC版IDEA常用快捷键
java·macos·intellij-idea
Wang's Blog2 天前
Lua: Web应用开发之OpenResty与Lapis框架深度指南
lua·openresty
江下枫2 天前
macOS 内置反恶意软件三板斧
macos
昵称已被吞噬~‘(*@﹏@*)’~2 天前
【强化学习】MacOS (M1芯片)上最新版本 MuJoCo 通用安装教程(最简洁),PS:不是 mujoco_py 的老版本
python·macos·机器学习·强化学习·mujoco
小锋学长生活大爆炸2 天前
【教程】MacOS绕过Apple Develop ID获取麦克风权限
macos·swift
TESmart碲视2 天前
如何设置双屏KVM切换器(Win+Mac双屏双系统共享一套键鼠):手把手详细指南
macos·计算机外设·mst·kvm切换器·tesmart·双屏kvm切换器·tesmart碲视
2501_915106322 天前
iOS开发中CPU功耗监控的实现与工具使用
android·macos·ios·小程序·uni-app·cocoa·iphone
TheNextByte12 天前
如何使用数据线或无线方式将照片从Mac传输到 iPhone?
macos·ios·iphone