Building PHP with nginx, and fast-cgi on EC2

by barce on March 2, 2012

Here’s my quick and dirty guide to building PHP with nginx and fast-cgi on EC2:

yum install mysqld
yum install mysql
yum install mysql-server
yum install mysql-devel
service mysqld start
/usr/bin/mysqladmin -u root password 'your_password'
/usr/bin/mysqld_safe &
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear
 php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mbstring p
hp-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
yum install spawn-fcgi
# Next, download spawn-fcgi init.d shell script:
wget http://bash.cyberciti.biz/dl/419.sh.zip
unzip 419.sh.zip
mv 419.sh /etc/init.d/php_cgi
chmod +x /etc/init.d/php_cgi
# Start php app server, enter:
/etc/init.d/php_cgi start

# check to see if it's running
netstat -tulpn | grep :9000

Your /etc/nginx/nginx.conf file should look like this:
https://gist.github.com/1961501

Leave a Comment

Previous post:

Next post: