Its super easy to set up a server for php if you're running apache as your default web sever. However, I recently had to figure out the how to run php an Ubuntu server which has been set up for rails using nginx and passenger. One option is to run apache on a different port and then route that through nginx but this method requires a lot of memory. The solution I choose was to use php-fpm.
apt-get install php5-fpm
In your /etc/php5/fpm/pool.d/www.conf file make sure that listen is set to:
listen = 127.0.0.1:9000
Then set up your server config for whatever site is using php like this:
server {
listen 80;
server_name domain.com www.domain.com;
index index.html;
root /var/www/[site_name];
location ~* \.php$ {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
And that's about it. Good luck.
UPDATE: If you need to send mail should use postfix instead of sendmail as php-fpm has a weird infinite loop bug with sendmail.