1.安装Homebrew
终端输入
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- 安装nginx
brew install nginx
3.控制启动停止命令,提示如下
emulator$ brew services stop nginx
Stopping `nginx`... (might take a while)
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)
emulator$ brew services start nginx
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
- 浏览器输入:
http://localhost:8080
下面提示代表成功
image.png- nginx 的安装目录
/usr/local/Cellar/nginx/1.17.7/html/
- 放入资源访问文件
/usr/local/Cellar/nginx/1.17.7/html/media
media$ ls
audio.mp4 audio_sidx.mp4
- 浏览器访问资源
浏览器输入或者通过代码都可以访问
http://localhost:8080/media/audio.mp4
这样就建立了一个可以访问的本地服务环境
网友评论