This is a nginx configuration for various PHP projects.
It is inspired by the work of perusio and rellimevad. Installation instructions initially found here.
- WordPress (currently does not support wp-supercache)
- Symfony 2
- Mac OS X Lion
- XCode
- Homebrew
- Git
This will describe all the steps required to install everything. All of this is done through Terminal.
Installation steps.
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
Finally, MySQL is configured using this command:
/usr/local/Cellar/mysql/5.5.20/bin/mysql_secure_installation
brew install mongodb
brew install postgresql
For new installations, You need to initialize the database:
initdb /usr/local/var/postgres -E utf8
This step will explain how to install PHP with fpm as well as other libraies you might need for your projects.
Please note that additional configuration options will be supplied by the homebrew installer. Please follow those directions.
There is no formula by default, but there is a github project maintainging all php brews. You can find it here.
You can omit the --with-mysql --with-pgsql
if you will not be using it.
brew install php54 --with-mysql --with-pgsql --with-fpm
brew install php54-apc
brew install php54-mongo
brew install php54-xdebug
First, install Nginx.
brew install nginx
Importing our configuration requires us to replace the old config files. And cloning the git repo.
-
Rename the default config directiory
mv /usr/local/etc/nginx /usr/local/etc/nginx.old
-
Clone the git repository from github. Or, alternatively, you can also download the files and copy the manually.
-
Use the default configs in
sites-available
to create your site configs. -
Create a
sites-enabled
directory.mkdir /usr/local/etc/nginx/sites-enabled
-
Create symlinks to your config files in
sites-available
insite-enabled
usingln -s
.
By default, the user is nobody
.
You'll need to give write access to your WordPress folder to the nginx user. You'll also need to give ownership to the files to the nginx user if you want the automatic updates to work. This is done using chown -R nobody /path/to/wp
. If you're using a different user, replace nobody
by that user.