Configuring Nginx


Nginx does not have a built-in PHP module like Apache does, so we need to install PHP-FPM.  No biggie, it's easy.  On your debian (or equivalent) system just do:
# sudo apt-get install php-fpm
That should be it really.  You can configure PHP-FPM just as you would any other instance of PHP by editing the php.ini file located at /etc/php{x}/fpm/php.ini.

Setting it up

Below is a simple virtual host config for Nginx, that contains everything you need to get your site up and running.
server {
        root /usr/share/example/public;
        index index.php;
        client_max_body_size 20M;
        if (!-e $request_filename){
                rewrite ^(.*)$ /index.php break;
        location /index.php {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                include snippets/fastcgi-php.conf;
                fastcgi_param APPLICATION_ENV production;
The client_max_body_size directive is not required but is added here to illustrate available configuration options.