Mac下如何安裝Nginx+PHP-FPM+Mariadb環(huán)境
1.Nginx
參考http://unix-like.dyndns-web.com/?p=242
brew install nginx
#設(shè)置自啟動
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
#Nginx命令
sudo nginx # start
sudo nginx -s stop # stop
sudo nginx -s reload # restart
#Nginx配置文件
/usr/local/etc/nginx
默認的Nginx端口是8080
2.PHP_FPM#設(shè)置自啟動
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
#Nginx命令
sudo nginx # start
sudo nginx -s stop # stop
sudo nginx -s reload # restart
#Nginx配置文件
/usr/local/etc/nginx
默認的Nginx端口是8080
#添加brew的PHP源
sudo brew tap homebrew/dupes
sudo brew tap homebrew/versions
sudo brew tap homebrew/homebrew-php
#安裝PHP
sudo brew install -v --with-fpm --disable-opcache --with-imap php56
#設(shè)置自啟動
ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
#設(shè)置環(huán)境變量
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
#啟動和關(guān)閉PHP_FPM
sudo /usr/local/opt/php56/sbin/php56-fpm start
sudo /usr/local/opt/php56/sbin/php56-fpm restart
sudo /usr/local/opt/php56/sbin/php56-fpm stop
sudo /usr/local/opt/php56/sbin/php56-fpm status
其實并不用上面那么復(fù)雜
Usage: /usr/local/sbin/php56-fpm {start|stop|force-quit|restart|reload|status}
直接運行
sudo php56-fpm start
sudo php56-fpm stop
sudo php56-fpm restart
3.Mariadbsudo brew tap homebrew/dupes
sudo brew tap homebrew/versions
sudo brew tap homebrew/homebrew-php
#安裝PHP
sudo brew install -v --with-fpm --disable-opcache --with-imap php56
#設(shè)置自啟動
ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
#設(shè)置環(huán)境變量
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
#啟動和關(guān)閉PHP_FPM
sudo /usr/local/opt/php56/sbin/php56-fpm start
sudo /usr/local/opt/php56/sbin/php56-fpm restart
sudo /usr/local/opt/php56/sbin/php56-fpm stop
sudo /usr/local/opt/php56/sbin/php56-fpm status
其實并不用上面那么復(fù)雜
Usage: /usr/local/sbin/php56-fpm {start|stop|force-quit|restart|reload|status}
直接運行
sudo php56-fpm start
sudo php56-fpm stop
sudo php56-fpm restart
brew install mariadb
#運行
mysql.server start
mysql.server stop
mysql.server restart
#設(shè)置密碼
mysql_secure_installation
#查詢版本
select @@version;
mysql啟動失敗解決方案#運行
mysql.server start
mysql.server stop
mysql.server restart
#設(shè)置密碼
mysql_secure_installation
#查詢版本
select @@version;
參考http://unix-like.dyndns-web.com/?p=242