mac 安装nginx

2020-02-17  本文已影响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

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

上一篇下一篇

猜你喜欢

热点阅读