Skip to content

Instantly share code, notes, and snippets.

@guillaumemolter
Forked from sumardi/nginx.default.conf
Last active November 6, 2018 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guillaumemolter/ebce6fa93a2ada5eaa96d6fd3a19751a to your computer and use it in GitHub Desktop.
Save guillaumemolter/ebce6fa93a2ada5eaa96d6fd3a19751a to your computer and use it in GitHub Desktop.
Install PHP-FPM and Nginx on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-mysql php-pdo \
php-mbstring php-cli \
php-imap php-gd php-xml php-openssl php-tokenizer
# Nginx Configuration
sudo nano /etc/nginx/conf.d/default.conf
# PHP-FPM Configuration
sudo nano /etc/php-fpm.d/www.conf
# Autostart Nginx, PHP-FPM and MySQL
sudo chkconfig nginx on
sudo chkconfig php-fpm on
location / {
root /var/www/html/public;
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 /usr/share/nginx/
html$fastcgi_script_name;
include fastcgi_params;
}
[...]
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0664
user = nginx
group = nginx
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment