在Mac上安装nginx

作者: maiyang | 来源:发表于2015-12-30 09:01 被阅读13074次

(嗨,大家好!欢迎关注我的公众号“茶歇驿站”,微信号“tech_tea”,请大家多多支持,欢迎大家分享,如若转载请注明出处~~~)

首先,你得安装好homebrew.

然后在命令行终端执行:

brew install nginx

通过homebrew,nginx默认被安装在/usr/local/Cellar/nginx/1.6.2, conf文件默认被安装在/usr/local/etc/nginx/nginx.conf

然后再浏览器中键入http://localhost:8080,即可访问到nginx的欢迎界面。

在开发过程中,我们可能还期望将端口去掉,绑定域名提供测试。

解决办法:

  1. 创建新的目录conf.d,/usr/local/etc/nginx/conf.d
  2. 创建单个服务所需的conf文件default.conf/usr/local/etc/nginx/conf.d/default.conf
  3. 然后将nginx的主文件nginx.conf中的server{}删除,替换成 include /usr/local/etc/nginx/conf.d/*.conf, nginx将可以加载存放在conf.d目录下的所有conf文件了。

sudo重启nginx。

如果遇到不能访问的情况,请前往nginx log目录:/usr/local/var/log/nginx/*.log,查看原因。

相关文章

  • 在Mac上自己搭建直播服务器

    在Mac上安装nginx 为什么要在Mac上安装nginx,是因为在nginx上有支持rtmp协议的模块,比较容易...

  • mac install nginx

    mac install nginx 在mac中安装nginx 安装nginxbrew install nginx ...

  • 【Nginx】2、Nginx安装

    【Nginx】2、Nginx安装 这里简单介绍Nginx在Windows、CentOS、Mac上的安装。 Ngin...

  • 【nginx安装配置】

    1.CentOS 7上安装Nginx 2.mac上安装Nginx Homebrew安装nginx 安装完以后,可以...

  • Mac上Nginx安装

    Mac上Nginx安装 Mac上安装Nginx需要Homebrew环境支持,所以第一步先安装Homebrew。 1...

  • 在Mac上安装nginx

    (嗨,大家好!欢迎关注我的公众号“茶歇驿站”,微信号“tech_tea”,请大家多多支持,欢迎大家分享,如若转载请...

  • nginx: [error] invalid PID numbe

    在Mac上用brew安装Nginx,然后修改Nginx配置文件,再重启时报出如下错误: nginx: [error...

  • Mac安装nginx

    Nginx安装 Mac环境安装Nginx 安装brew略 安装nginxbrew install nginx安装目...

  • Nginx+RTMP搭建直播推拉流服务

    基础服务 安装nginx(下面是包管理器安装,比较推荐源码安装) mac上安装nginx+live 参考: htt...

  • nginx入门学习

    安装nginx mac安装 linux安装 nginx下载地址:https://nginx.org/downloa...

网友评论

本文标题:在Mac上安装nginx

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