nginx安装
一、安装环境
安装环境:mac os
二、下载安装
执行命令brew install nginx
安装nginx。
安装最终位置:/usr/local/etc/nginx
。
安装命令执行流程如下:
➜ brew install nginx
==> Installing dependencies for nginx: pcre, openssl
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.39.yosemite.bottle.tar.gz
curl: (6) Could not resolve host: homebrew.bintray.com
Error: Failed to download resource "pcre"
Download failed: https://homebrew.bintray.com/bottles/pcre-8.39.yosemite.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/pcre/8.39 --enable-utf8 --enable-pcre8 --enable-
==> make
==> make test
==> make install
�� /usr/local/Cellar/pcre/8.39: 203 files, 5.4M, built in 1 minute 41 seconds
==> Installing nginx dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.yosemite.bottle.tar.g
######################################################################## 100.0%
==> Pouring openssl-1.0.2h_1.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
�� /usr/local/Cellar/openssl/1.0.2h_1: 1,691 files, 12.0M
==> Installing nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring nginx-1.10.1.yosemite.bottle.tar.gz
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
nginx
==> Summary
�� /usr/local/Cellar/nginx/1.10.1: 7 files, 976.2K
二、验证成功
访问:http://localhost:8080/
出现如下页面即安装成功: