【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
相关推荐
李游Leo2 小时前
LaTeX TeX Live 安装与 CTAN 国内镜像配置(Windows / macOS / Linux 全流程)
linux·windows·macos
华溢澄6 小时前
macOS下基于Qt/C++的OpenGL开发环境的搭建
c++·qt·macos·opengl
我发在否8 小时前
Lua > OpenResty HelloWorld
lua·openresty
Mr. Cao code8 小时前
探索OpenResty:高性能Web开发利器
linux·运维·服务器·前端·nginx·ubuntu·openresty
浮生若茶808817 小时前
Flutter环境搭建全攻略之-Macos环境搭建
flutter·macos
xingxing_F1 天前
SoundSource for Mac 音频控制工具
macos·音视频
snows_l1 天前
MacOS 通过Homebrew 安装nvm
前端·macos
焦虑的二狗1 天前
macOS中设置环境变量的各文件及作用域
macos
西京刀客1 天前
macos安装openjdk17
java·macos·java17
@Dai1 天前
MacOS微信双开,亲测有效
macos·微信