mac 安装nginx php环境
➜ etc brew install nginx
==> Installing dependencies for nginx: pcre, openssl
==> Installing nginx dependency: pcre
==> Downloading https://homebrew.bintray.com/bottles/pcre-8.38.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pcre-8.38.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/pcre/8.38: 203 files, 5.4M
==> Installing nginx dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2h_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2h_1.el_capitan.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, 12M
==> Installing nginx
==> Downloading https://homebrew.bintray.com/bottles/nginx-1.10.0.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring nginx-1.10.0.el_capitan.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.0: 7 files, 971.9K
启动nginx,输入
nginx
访问http://localhost:8080看到如下界面表示安装成功
2.安装php,mac系统自带php,如果没有强迫症,实用自带的就可以,当然也可以
brew install php71
启动php
sudo php-fpm -D
[07-Feb-2019 19:37:08] ERROR: failed to open error_log (/usr/local/var/log/php-fpm.log): No such file or directory (2)
[07-Feb-2019 19:37:08] ERROR: failed to post process the configuration
[07-Feb-2019 19:37:08] ERROR: FPM initialization failed
按提示创建目录后,重启即可解决问题。
关闭php
killall php-fpm