使用brew安装nginx
$ brew install nginx

启动nginx

sudo nginx

访问localhost:8080 发现已出现nginx的欢迎页面了。

为方便期间,做个软连接:

sudo ln -s /usr/local/bin/nginx /usr/bin/nginx #我的mac没有成功,提示没有权限

常用的指令有:

nginx -V 查看版本,以及配置文件地址
nginx -v 查看版本
nginx -c filename 指定配置文件
nginx -h 帮助 打开 nginx
sudo nginx nginx 重新加载配置|重启|停止|退出
nginx -s reload|reopen|stop|quit 测试配置是否有语法错误
nginx -t

例子:

MacBookPro:superlists apple$ ln -s /usr/local/bin/nginx /usr/bin/nginx

ln: /usr/bin/nginx: Operation not permitted
MacBookPro:superlists apple$ sudo nginx
Password:
MacBookPro:superlists apple$ nginx -v nginx version: nginx/1.10.
MacBookPro:superlists apple$ nginx -V nginx version: nginx/1.10.
built by clang 8.0. (clang-800.0.42.1)
built with OpenSSL 1.1.0c Nov
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/1.10.2_1 --with-http_ssl_module --with-pcre --sbin-path=/usr/local/Cellar/nginx/1.10.2_1/bin/nginx --with-cc-opt='-I/usr/local/opt/pcre/include -I/usr/local/opt/openssl@1.1/include' --with-ld-opt='-L/usr/local/opt/pcre/lib -L/usr/local/opt/openssl@1.1/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_gzip_static_module --with-ipv6
 

Nginx安装日志如下:

 MacBookPro:superlists apple$ brew install nginx
Updating Homebrew...
==> Auto-updated Homebrew!
Updated tap (homebrew/core).
==> New Formulae
cnats mingw-w64-binutils opencoarrays
imagemagick@ molecule watchexec
==> Updated Formulae
abcde gitup mongoose
afl-fuzz gnupg-pkcs11-scd openshift-cli
ansible godep orientdb
aria2 groonga pius
arping gtk+ pngcrush
aws-sdk-cpp h2o pyenv
awscli htmlcleaner rocksdb
certbot httrack speedtest_cli
deis hyperscan sshguard
deisctl ios-webkit-debug-proxy swaks
docker-compose iso-codes swiftformat
docker-machine kobalt tcpkali
docker-machine-nfs libgcrypt tomcat
dpkg libgtop vim
eiffelstudio libtasn1 xz
fabio libxc yank
flow lighttpd yash
fossil logentries youtube-dl
fwup makeself ==> Installing dependencies for nginx: pcre, openssl@1.1
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.39.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pcre-8.39.sierra.bottle.tar.gz

Mac上使用brew安装Nginx服务器的更多相关文章

  1. Mac下用brew安装nginx

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

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

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

  3. 【mac】mac上使用brew 安装速度慢/每次使用brew 都会卡在updating homebrew不动/更换homebrew的镜像源

    有没有出现一下这样的情况: 如果有,请继续往下走 1.打开mac的命令窗口,键入如下命令 cd /usr/local/Homebrew 2.更换homebrew的默认源[更换为中科大的镜像源] git ...

  4. Mac上使用brew安装nvm来支持多版本的Nodejs

    brew方式 如果机器没有安装过node,那么首先brew install nvm安装nvm. 其次需要在shell的配置文件(~/.bashrc, ~/.profile, or ~/.zshrc)中 ...

  5. 在CentOS 7上安装Nginx服务器

    下面我就我在CentOS上安装Nginx经验做简单的记录,以备后查. 1.下载nginx-release包 以CentOS 7为例,下载nginx软件包:http://nginx.org/packag ...

  6. 在Linux和Windows系统上安装Nginx服务器的教程

    在Linux和Windows系统上安装Nginx服务器的教程  1.在CentOS系统上安装Nginx 在 CentOS6 版本的 EPEL 源中,已经加入了 nginx 的 rpm 包,不过此 RP ...

  7. mac中使用brew安装软件,下载太慢怎么办?

    mac中使用brew安装软件,下载太慢怎么办? 本文所说的软件是指较大的软件,如果软件较小,例如软件只有几M,那么使用此方法后,提升会非常小. 了解brew原理: 1: 从网络下载安装包 2: 执行一 ...

  8. mac 下用 brew 安装mongodb

    转自:mac 下用 brew 安装mongodb 经过这位仁兄的文章指导,终于连上了mongodb. 启动mongo数据库,就是打开一个终端sudo mongod,然后打开另一个终端sudo mong ...

  9. Mac上tesseract-OCR的安装配置

    Mac上tesseract-OCR的安装配置 tesseract简介 OCR(Optical Character Recognition)即光学字符识别技术,专门用于对图片文字进行识别,并获取文本. ...

随机推荐

  1. 查询SQL时间段内执行过的哪些SQL语句

    QS.creation_time, ) , (( ) ) AS statement_text, ST.text, QS.total_worker_time, QS.last_worker_time, ...

  2. python 爬虫实例(一)

    一个简单的爬虫工程 环境: OS:Window10 python:3.7 安装一些库文件 pip install requests pip install beautifulsoup4 pip ins ...

  3. composer安装扩展包异常

    我是tp5.1下,用composer安装扩展包,在命令行运行,无任何不反应,不下载也不报错,这时,我们先ctrl+c退出执行的命令,然后在tp5.1根目录下,找到composer.json文件,并用编 ...

  4. layer.prompt添加多个输入框

    原文链接:https://www.jianshu.com/p/65fea33e6750 我们都知道layer.prompt官网上的例子是一个弹出框,那么有没有可能出来多个呢,当然是可以的 1.首先增加 ...

  5. LeetCode 590. N叉树的后序遍历(N-ary Tree Postorder Traversal)

    590. N叉树的后序遍历 590. N-ary Tree Postorder Traversal 题目描述 给定一个 N 叉树,返回其节点值的后序遍历. LeetCode590. N-ary Tre ...

  6. [转帖]进程上下文频繁切换导致load average过高

    进程上下文频繁切换导致load average过高 2016年6月26日admin发表评论阅读评论 http://www.361way.com/linux-context-switch/5131.ht ...

  7. 多线程(7)— JDK对锁优化的努力

    JDK内部的“锁”优化策略 1. 锁偏向 锁偏向是针对加锁操作的优化手段,核心思想是:如果一个线程获得了锁,那么锁就进入偏向模式,当这个线程再次请求锁时,无须再做任何同步操作,这样就节省了大量有关锁申 ...

  8. C++ 重载运算符返回值 和 返回引用的原因

    原因是: +,-,*等返回不了引用,比如+运算符,可以如下重载(为了简单,假设A 只有int x:int y) A operator+(A a,A b) {A sum;   sum.x=a.x+b.x ...

  9. Python爬虫框架

    本文章的源代码来源于https://github.com/Holit/Web-Crawler-Framwork 一.爬虫框架的代码 import urllib.request from bs4 imp ...

  10. golang 管理 pidfile

    Pidfile 存储了进程的进程 id.一般情况下 pidfile 有以下几个作用: 其他进程可以读取 pidfile 获取运行进程的 pid(当然也可以通过其他命令 动态获取) 在启动进程前先检查 ...