[关闭]
@Tyhj 2019-01-23T23:00:48.000000Z 字数 545 阅读 1437

Mac下搭建nginx文件服务器

linux


安装homebrew

  1. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装nginx

  1. brew install nginx

启动nginx

  1. brew services start nginx

成功后,使用浏览器打开http://localhost:8080

nginx安装文件目录

  1. /usr/local/Cellar/nginx

nginx配置文件目录

  1. /usr/local/etc/nginx

config文件目录

  1. /usr/local/etc/nginx/nginx.conf

配置静态文件服务

  1. vim /usr/local/etc/nginx/nginx.conf

随便配置一下,重新开启服务

  1. brew services restart nginx

屏幕快照 2019-01-23 下午11.00.11.png-124.1kB

设置开机启动

  1. sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
  2. sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist

卸载

  1. brew uninstall nginx
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注