https://blog.frd.mn/install-nginx-php-fpm-mysql-and-phpmyadmin-on-os-x-mavericks-using-homebrew/
Install: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If installed already: brew update && brew upgrade
brew tap homebrew/dupes
brew tap homebrew/php
Install it:
brew install --without-apache --with-fpm --with-mysql php56
BASH: echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile && . ~/.bash_profile
ZSH: echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc && . ~/.zshrc
Create dir: mkdir -p ~/Library/LaunchAgents
Symlink to your LaunchAgents: ln -sfv /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
Start it: launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
Check it's running: lsof -Pni4 | grep LISTEN | grep php
Brew install: brew install mysql
Run the setup security program: mysql_secure_installation
Auto starting: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Install autoconf, which is needed for the installation of phpMyAdmin:
brew install autoconf
And set the $PHP_AUTOCONF
environment variable:
If you use BASH: 'PHP_AUTOCONF="'$(which autoconf)'"' >> ~/.bash_profile && . ~/.bash_profile
or ZSH:echo 'PHP_AUTOCONF="'$(which autoconf)'"' >> ~/.zshrc && . ~/.zshrc
Since now you're all set, you can finish this part with the actual installation of phpMyAdmin:
brew install phpmyadmin
brew install nginx
#Since you want to use port 80 (default HTTP port), you have to run the Nginx process with root privileges:
sudo cp -v /usr/local/opt/nginx/*.plist /Library/LaunchDaemons/
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
Start nginx: sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
Test: curl -IL http://127.0.0.1:8080
You're done. Nginx runs on 8080. TO configure further
mkdir -p /usr/local/etc/nginx/logs
mkdir -p /usr/local/etc/nginx/sites-available
mkdir -p /usr/local/etc/nginx/sites-enabled
mkdir -p /usr/local/etc/nginx/conf.d
mkdir -p /usr/local/etc/nginx/ssl
sudo mkdir -p /var/www
sudo chown :staff /var/www
sudo chmod 775 /var/www
Remove the current nginx.conf (which is also available as /usr/local/etc/nginx/nginx.conf.default in case you want to restore the defaults) and download my custom from GitHub:
rm /usr/local/etc/nginx/nginx.conf
Get Jonas Friedmann's nginx conf curl -L https://gist.github.com/frdmn/7853158/raw/nginx.conf -o /usr/local/etc/nginx/nginx.conf
Get his php-fpm configuration as well
curl -L https://gist.github.com/frdmn/7853158/raw/php-fpm -o /usr/local/etc/nginx/conf.d/php-fpm -o /usr/local/etc/nginx/conf.d/php-fpm
curl -L https://gist.github.com/frdmn/7853158/raw/sites-available_default -o /usr/local/etc/nginx/sites-available/default
curl -L https://gist.github.com/frdmn/7853158/raw/sites-available_default-ssl -o /usr/local/etc/nginx/sites-available/default-ssl
curl -L https://gist.github.com/frdmn/7853158/raw/sites-available_phpmyadmin -o /usr/local/etc/nginx/sites-available/phpmyadmin
Clone Jonas's example virtual hosts (including 404/403 error pages and a phpinfo() status site) using git:
git clone http://git.frd.mn/frdmn/nginx-virtual-host.git /var/www
rm -rf /var/www/.git
And remove the .git folder so your content won't get tracked by git.
Hi. Seems like homebrew/php is deprecated now... tapping core doesn't seem to fix missing options (--with-fpm etc.). How to do?