Skip to content

Instantly share code, notes, and snippets.

@aindong
Forked from santoshachari/nginx.default.conf
Last active November 18, 2015 16:37
Show Gist options
  • Save aindong/d6919cc7f7bfbf8a3f03 to your computer and use it in GitHub Desktop.
Save aindong/d6919cc7f7bfbf8a3f03 to your computer and use it in GitHub Desktop.
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 php56-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
server{
listen 80;
root /var/www/html/medix-clinic/public;
index index.php index.html index.htm;
location / {
#if ($http_x_forwarded_proto != 'https') {
# rewrite ^ https://$host$request_uri? permanent;
#}
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/medix-clinic/public$fastcgi_script_name;
include fastcgi_params;
}
}
[...]
user = nginx
group = nginx
;listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock
;listen.owner = nobody
listen.owner = nginx
;listen.group = nobody
listen.group = 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