行业知识
【MAC】OpenResty安装
2026-11-30 08:37:17
来源:互联网转载
首先官���网站:http://openresty.org/cn/download.html
安装:
我是安装官网去执行的安装命令
配置环境变量
1.打开配置文件vim ~/.bash_profile2.粘贴进去变量配置#OPENRESTYexport NGINX_HOME=/opt/homebrew/etc/openrestyexport PATH=$PATH:$NGINX_HOME/sbin3.刷新配置source ~/.bash_profile
测试1
查看是否安装成功:nginx -vopenresty -v
测试2
在nginx.conf配置中加入下面代码
server { #监听端口,若你的6699端口已经被占用,则需要修改 listen 6699; server_name localhost; location / { default_type text/html; content_by_lua_block { ngx.say("HelloWorld") } } } 启动和关闭
openResty的启动和停止:(要在配置文件目录下)启动:openresty -p `pwd` -c nginx.conf 停止:openresty -s quit -p `pwd` -c nginx.conf
上一篇:沃云服务器快照