美文网首页
mac的nginx安装

mac的nginx安装

作者: jkian | 来源:发表于2018-06-07 09:41 被阅读0次

1、首先,安装Homebrew,打开终端,输入:

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

2、依赖Homebrew安装Nginx

    输入:brew install nginx 

3、启动Nginx  输入:  nginx 

安装完以后,可以在终端输出的信息里看到一些配置路径:

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

/usr/local/var/www (服务器默认路径)

/usr/local/Cellar/nginx/1.8.0 (安装路径)

访问localhost:8080,成功说明安装好了

Nginx常见命令

nginx -s stop  :快速停止nginx

nginx -s quit  :完整有序的停止nginx

nginx -s reload 重新加载

nginx -s reopen  :重新打开日志文件

nginx -t /-c(nginx -t -c /path/to/nginx.conf )测试nginx.conf配置

其他的停止nginx 方式:

ps -ef | grep nginx

kill -QUIT 主进程号     :从容停止Nginx

kill -TERM 主进程号     :快速停止Nginx

pkill -9 nginx          :强制停止Nginx

启动nginx:

nginx -c /path/to/nginx.conf

相关文章

网友评论

      本文标题:mac的nginx安装

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