Today I will be talking you through Silverstripe running on Nginx via PHP-FPM with PostgreSQL on ubuntu.
First of all we will need Nginx.
$ sudo apt-get install nginx
Install PostgreSQL.
$ sudo apt-get install postgresql-9.1
Now we will need PHP and PHP-FPM.
$ sudo apt-get install php5 php5-cli php5-dev php5-pgsql php5-gd php5-curl php5-tidy
If your using PHP 5.5 you will need to install PHP5-JSON.
$ sudo apt-get install php5-json
Install composer. We will use composer to install Silverstripe.
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
Get Silverstripe code.
$ composer create-project silverstripe/installer /var/www/silverstripe/ 3.1.2
This will download the code for Silverstripe 3.1.2 into /var/www/silverstripe/ Now we must add the PostgreSQL plugin to the composer.json file in /var/www/silverstripe/
$ cd /var/www/silverstripe/
$ vim composer.json
And add the following line to the require section:
"silverstripe/postgresql": "dev-master"
Save the file and run the following command:
$ composer update
Now that we have all the code we need installed, now all that is left is the nginx config.
$ cd /etc/nginx/sites-available/
$ sudo vim silverstripe.conf
Here is an example nginx config: https://gist.github.com/chtombleson/8703899
Note: if you get any 502 bad gateway errors in the admin section you will need to add some extra settings, which are in the first comment in the above Nginx config example.
Now that we have the Nginx config setup we get need to enable it as follows:
$ sudo ln -s /etc/nginx/sites-available/silverstripe.conf /etc/nginx/sites-enabled/silverstripe.conf
$ sudo /etc/init.d/nginx restart
Now to create the database and database user.
$ sudo su - postgres
$ createuser -SDRP [database username]
$ createdb -O [database username] [database name]
Now go to your newly setup site http://example.com/install.php and run through the installer and once finished it will redirect you to your new Silverstripe site.