首页 > 系统服务 > 详细

macos系统安装nginx

时间:2019-08-23 01:12:13      阅读:136      评论:0      收藏:0      [点我收藏+]

 

MacOS系统安装软件:


macos系统下没有yum和apt-get命令,要安装软件需要使用homebrew。

1、安装homebrew:

安装:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
卸载:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

PS:如果出现ping github.com超时的情况,查找第三方ip,如192.30.253.112 github.com添加到/etc/hosts最后一行。

2、利用homebrew安装、卸载软件包:

$ brew install pcre bzip2 openssl
$ brew uninstall python
$ brew search <packageName>
$ brew list 查看已安装
$ brew info <packageName> 查看包信息
$ brew -v
$ brew -h
$ brew install nginx 安装过程会自己安装依赖关系
$ brew services start nginx 启动nginx
$ brew services stop nginx 关闭nginx
$ brew services reload nginx 重启nginx
$ brew uninstall nginx 卸载nginx

3、nginx文件目录结构:

nginx安装文件目录
(...网站路径)
/usr/local/Cellar/nginx


nginx配置文件路径
/usr/local/etc/nginx/nginx.conf


nginx日志文件路径
/usr/local/var/log/

nginx运行pid文件路径
/usr/local/var/run/

系统hosts文件位置

/private/etc/hosts

4、其他

注意事项:
macos x系统对权限的约束非常严格,不能用root执行脚本;
nginx.conf中user不能配置成root或macos,配置完会报错;
运行时,目录属主:属组,属主需要改成conf中user的用户,默认nobody,属组改不了,默认staff(包含所有用户的组),
但是即使如此,如果不配置属主,nginx并不生效,也就是说这个组没个卵用,目录配成777也没用。

 

macos系统安装nginx

原文:https://www.cnblogs.com/immense/p/11397555.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!