Skip to content

Instantly share code, notes, and snippets.

@svrl
Created November 7, 2013 06:57
Show Gist options
  • Save svrl/7350225 to your computer and use it in GitHub Desktop.
Save svrl/7350225 to your computer and use it in GitHub Desktop.
Installing NGINX and PHP-FPM on OS X 10.9 with Homebrew

OS X 10.9 - Nginx, php commands

Installing PHP 5.5 (with FPM) on Mac OS X

Search for available PHP formulas (formula’s in homebrews are equivalent to packages in aptitude)

brew search php

It will return long list of php 5.2, 5.3, 5.4, 5.5 packages. We need 5.5. Tap it using:

brew tap josegonzalez/php
brew tap homebrew/dupes

If you do not tap homebrew/dupes you will get Error: No available formula for zlib

Before we build PHP 5.5, you may like to exercise options using:

brew options php55

We have built it using:

brew install php55 --with-fpm --with-imap --without-apache --with-mssql --with-pgsql --with-debug

Adding PHP-FPM to startup routine

Please check exact plist filename in /usr/local/Cellar/php54/

cp /usr/local/Cellar/php55/5.5.5/homebrew-php.josegonzalez.php55.plist ~/Library/LaunchAgents/

To Start PHP-FPM:

launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist

To Stop PHP-FPM

launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist

Installing Nginx on Mac OS X

Run following command:

brew install nginx

Adding Nginx to startup routine

Please check exact plist filename in /usr/local/Cellar/mysql/

cp /usr/local/Cellar/nginx/1.4.3/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/

To Start

launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

To Stop

launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist

Changes to Nginx Config (optional)

By default, Nginx setup expects you to define all virtual hosts in /usr/local/etc/nginx/nginx.conf

Edit default config file and following line to http{..} block

include sites-enabled/*.conf;

Next you can create sites-available and sites-enabled folder to manage virtual hosts config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment