brew 安装 nginx

  1. 安装
brew install nginx

brew会自动安装依赖pcre, openssl@1.1,安装路径在/usr/local/homebrew/Cellar/下面,安装过程提示,提示信息的安装路径与启动命令

If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile
/usr/local/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/homebrew/etc/nginx/servers/.
To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
nginx
/usr/local/homebrew/Cellar/nginx/1.10.3: 8 files, 980.9KB, built in 1 minute 37 seconds

  1. nginx.conf
  • 安装完成后,如果在nginx.conf修改root的路径,有可能会报403,需要chmod修改root指向目录的权限
  • 如果开启日志,需要在
    /usr/local/homebrew/Cellar/nginx/1.10.3下面创建logs目录
  1. 启动命令
    第1次启动用命令nginx -s reload,重启会碰到pid文件错误,需要用下面的命令
sudo /usr/local/homebrew/Cellar/nginx/1.10.3/bin/nginx
sudo /usr/local/homebrew/Cellar/nginx/1.10.3/bin/nginx -s reload
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容