美文网首页
mac 安装nginx

mac 安装nginx

作者: 爱玩保龄球 | 来源:发表于2020-02-17 14:53 被阅读0次

1.安装Homebrew
终端输入

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
  1. 安装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)
  1. 浏览器输入:
    http://localhost:8080

下面提示代表成功

image.png
  1. nginx 的安装目录
/usr/local/Cellar/nginx/1.17.7/html/
  1. 放入资源访问文件
/usr/local/Cellar/nginx/1.17.7/html/media
media$ ls
audio.mp4      audio_sidx.mp4
  1. 浏览器访问资源

浏览器输入或者通过代码都可以访问
http://localhost:8080/media/audio.mp4

这样就建立了一个可以访问的本地服务环境

相关文章

网友评论

      本文标题:mac 安装nginx

      本文链接:https://www.haomeiwen.com/subject/wembfhtx.html