Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
PHP5.6 and NGINX: Install PHP56-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and php56-FPM
sudo yum install -y nginx php56-fpm
# Install php56 extensions
sudo yum install -y php56-devel php-mysql php56-pdo php56-pear php56-mbstring php56-cli php56-odbc php56-imap php56-gd php56-xml php56-soap
#Install php mysql for pdo
sudo yum install php56-mysqlnd
# Install php56-APC
sudo yum install -y php56-pecl-apc
sudo yum install -y pcre-devel
# Install MySQL
sudo yum -y install mysql-server mysql
# Nginx Configuration
sudo nano /etc/nginx/conf.d/default.conf
# php56-FPM Configuration
sudo nano /etc/php-fpm.d/www.conf
# Autostart Nginx, php56-FPM and MySQL
sudo chkconfig nginx on
sudo chkconfig mysqld on
sudo chkconfig php-fpm on
location / {
root /var/www/html;
index index.php index.html index.htm;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
user = nginx
group = nginx
;listen =
listen = /var/run/php-fpm/php-fpm.sock
;listen.owner = nobody
listen.owner = nginx
; = nobody = nginx
;listen.mode = 0666
listen.mode = 0664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.