1、安装

brew install nginx

2、修改配置文件

sudo vi /usr/local/etc/nginx/nginx.conf

修改默认的8080端口为80

修改日志文件地方
error_log logs/error.log; pid logs/nginx.pid; access_log logs/access.log; 按上面修改后日志文件在/usr/local/opt/nginx/logs

3、修改管理员权限

sudo chown root:wheel/usr/local/opt/nginx/bin/nginx
sudo chmod u+s/usr/local/opt/nginx/bin/nginx

4、加上launchctl控制

mkdir -p ~/Library/LaunchAgents

cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

5、启动nginx

sudo nginx #启动

sudo nginx -t #测试配置文件是否有错

sudo nginx -s reload #重启nginx

6、问题

如果出现nginx: [error] invalid PID number "" in "/usr/local/var/run/nginx/nginx.pid",则需要
sudo nginx -c /usr/local/etc/nginx/nginx.conf
sudo nginx -s reload

Mac使用brew安装nginx,并解决端口访问权限问题的更多相关文章

  1. Mac使用brew安装nginx,并解决端口80访问权限问题

    1.安装 brew install nginx 2.修改配置文件 sudo vi /usr/local/etc/nginx/nginx.conf 修改默认的8080端口为80 修改日志文件地方 err ...

  2. mac 使用 brew 安装 nginx 及各种命令

    一.安装 brew install nginx 或 sudo brew install nginx 二.启动 brew services start nginx 或 sudo brew service ...

  3. Mac下用brew安装nginx

    1. nginx nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TC ...

  4. Mac上使用brew安装Nginx服务器

    使用brew安装nginx $ brew install nginx 启动nginx sudo nginx 访问localhost:8080 发现已出现nginx的欢迎页面了.  为方便期间,做个软 ...

  5. mac无坑安装nginx

    mac无坑安装nginx 首先需要mac下有一个缺失的软件包的管理器------->homebrew 1.打开终端输入 brew update 说明homebrew已经安装好了 2.继续执行以下 ...

  6. 【MySQL】Mac通过brew安装的MySQL重启方法

    问题 在 Mac 上通过 brew install mysql 安装的的MySQL使用基本MySQL命令重启会失败: mysql.server stop mysql.server start mysq ...

  7. 在 Mac OSX 上安装 nginx

    今天在使用 brew 安装 nginx 时,提示错误,安装不上去: brew install nginx, 提示:/usr/local is not writable. 这个是需要修改 /usr/lo ...

  8. Mac OS使用brew安装Nginx、MySQL、PHP-FPM的LAMP开发环境

    准备工作 新版的 Mac OS 内置了Apache 和 PHP,我的系统版本是OS X 10.9.3,可以通过以下命令查看Apache和PHP的版本号: httpd -v Server version ...

  9. Mac下brew/memcached/nginx/iterm/zsh的安装

    brew  https://www.cnblogs.com/fireworld/p/8609190.html memcached https://blog.csdn.net/whereismatrix ...

随机推荐

  1. spring学习 十一 AspectJ-based的通知入门 不带参数的通知

    AspectJ-Based方式的AOP,通知类不需要实现任何接口,且前置通知,后置通知,环绕通知,异常通知都可以写在一个类中,下面先实现一个简单的,不带参数的通知. 第一步定义通知类,通知类中的通知( ...

  2. python之初级篇2

    一.数字类型 1)整数 int 类型 - bit_length() # 查询以二进制表示一个数字的值所需的位数 - int.from_bytes(bytes,byteorder) # 返回给定字节数组 ...

  3. tomcat 服务器故障排除

    故障现象 通过浏览器访问tomcat服务器发现服务器没有响应. 问题分析检查 登陆服务器发现,TOMCAT服务器并没有宕机,服务还在. 使用JPS命令查看了一下tomcat的进程ID,获取进程ID后, ...

  4. myBatis中if test 字符串注意事项

    错误写法: <if test="userName == 'boshen'"> AND `USER_NAME` = #{userName} </if> 正确写 ...

  5. c#利用循环将类实例化为对象

    参考:https://yq.aliyun.com/wenzhang/show_6121 上面的代码每次使用前并没有实例化,会报错,实例化以下就好了,参考:http://bbs.csdn.net/top ...

  6. 软件推荐-国内参数优化软件:1stOpt - First Optimizationg

    首页:http://www.7d-soft.com/index.htm 4.0新功能 (预定2010年8月6日): 1:支持复数拟合.复数方程组计算: 2:支持微分方程拟合求解: 3:通用全局优化求解 ...

  7. BZOJ 1024 [SCOI2009]生日快乐 (搜索)

    1024: [SCOI2009]生日快乐 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 3025  Solved: 2201[Submit][Statu ...

  8. 【慕课网实战】Spark Streaming实时流处理项目实战笔记五之铭文升级版

    铭文一级: 单节点单broker的部署及使用 $KAFKA_HOME/config/server.propertiesbroker.id=0listenershost.namelog.dirszook ...

  9. thrift学习总结

    thrift 重要的几个组件有 :数据类型,transport,protocol,versioning,processor 1.数据类型 thrift的数据类型有1.一些原生类型,比如string,i ...

  10. windows安装mysql 5.7

    1.下载mysql 5.7 压缩包,解压在D:\software\mysql\目录下,更名称mysql-5.7.22 ,并新建data空文件夹和my.ini文件 my.ini文件的内容 [client ...