mac使用Homebrew安装开发工具
Homebrew 安装
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
一、安装OpenResty
安装并设置环境变量
brew install openresty/brew/openresty
export PATH=/usr/local/Cellar/openresty/1.19.9.1_2/nginx/sbin/:$PATH
nginx -v
mkdir -p devtools/nginx/seckillproject/conf
mkdir -p devtools/nginx/seckillproject/logs
cd devtools/nginx/seckillproject
配置文件内容
在conf目录中创建nginx.conf文件
vi conf/nginx.conf
添加配置
worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { server { listen 8080; location / { default_type text/html; content_by_lua_block { ngx.say("hello, world
") } } } }
验证:启动nginx后,访问localhost:8080,可以访问即可。
# 启动
nginx -p `pwd`/ -c conf/nginx.conf
# 查看 ps -ef|grep nginx
# 停止 nginx -p pwd -s stop
二、安装MySQL
安装并设置环境变量
brew install mysql@5.7 export PATH=/usr/local/opt/mysql@5.7/bin:$PATH
验证
mysql.server start mysql_secure_installation mysql -uroot -p show databases; mysql.server stop
三、安装redis
安装并验证
brew install redis /usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf ##另起一个窗口,使用客户端验证 redis-cli -h 127.0.0.1 -p 6379