Skip to content

Instantly share code, notes, and snippets.

@ppinto20
Created November 15, 2018 00:32
Show Gist options
  • Save ppinto20/9280de33f6b9178ab428adbc5232a1f8 to your computer and use it in GitHub Desktop.
Save ppinto20/9280de33f6b9178ab428adbc5232a1f8 to your computer and use it in GitHub Desktop.
Ubuntu 16.04.1 LTS LEMP Recipe
# Update repositories
sudo apt-get update
# Upgrade packages
sudo apt-get upgrade -y
# Install and secure mysql-server (follow instructions)
sudo apt-get install mysql-server
sudo mysql_secure_installation
# Install other packages
sudo apt-get install -y php7.0 php-fpm php-mysql nginx
# Set cgi.fix_pathinfo=0
sudo nano /etc/php/7.0/fpm/php.ini
# Restart FPM
sudo systemctl restart php7.0-fpm
# Update default server block (see attached)
sudo nano /etc/nginx/sites-available/default
# Test nginx config
sudo nginx -t
# Reload nginx
sudo systemctl reload nginx
# Download composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
# Move composer to global dir
sudo mv composer.phar /usr/local/bin/composer
# Generate a new SSH key for repo access
ssh-keygen -t rsa -b 4096
cat ~/.ssh/id_rsa.pub
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name server_domain_or_IP;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment