mac使用Homebrew安裝開發工具
阿新 • • 發佈:2022-04-02
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("<p>hello, world</p>") } } } }
驗證:啟動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