Preparatory work
The new Mac OS has built-in Apache and PHP, and you can view the Apache and PHP version numbers with the following commands:
# httpd-V
Installing homebrew
The homebrew under the Mac is equivalent to Apt-get, Yum under Linux, and can get the latest version of the various installation packages.
" $ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "
After the installation is complete, run the following command to check if the installation was successful
Brew Doctor
Update, upgrade under Brew source
Brew Update && Brew upgrade
Installing Nginx
Install Nginx
Modifying a configuration file
sudo vim/usr/local/etc/nginx/nginx.conf #修改默认的8080端口为80
Set a self-starter
sudo cp -v/usr/local/opt/nginx/homebrew.mxcl.nginx.plist/library/launchdaemons/sudochown Root:wheel/library/launchdaemons/homebrew.mxcl.nginx.plist
Start Nginx Service
sudo launchctl load/library/launchdaemons/homebrew.mxcl.nginx.plist
Now listen to port 80 by default and run the following command to test
Curl-il http://127.0.0.1:80
View Nginx Help
Nginx-h
Stop Nginx Service
sudo launchctl unload/library/launchdaemons/homebrew.mxcl.nginx.plist
php-fpm
Because brew does not contain PHP-FPM by default, you must first add a
Install homebrew, Nginx, PHP, Mysql
on your Mac