Skip to content

Instantly share code, notes, and snippets.

@leonistor
Last active February 6, 2021 11:38
Show Gist options
  • Select an option

  • Save leonistor/6a2daa87576cef433be315b64117aeea to your computer and use it in GitHub Desktop.

Select an option

Save leonistor/6a2daa87576cef433be315b64117aeea to your computer and use it in GitHub Desktop.
php, nginx, mysql on ubuntu 16 from ppa
server {
listen 80 default_server;
listen [::]:80 default_server;
root /home/sinoptix/www;
index index.php index.html;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
# cleanup locale settings, so apt won't complain (mostly)
# https://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue
# no tested:
# sudo apt-get install -y language-pack-en-base
# list locales, should have "en_US.UTF-8" only
sudo locale
# then for each of them
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
# last but not least
sudo sh -c "echo \"LC_ALL=en_US.UTF-8\" >> /etc/default/locale"
sudo sh -c "echo \"LANGUAGE=en_US.UTF-8\" >> /etc/default/locale"
# check if php already installed, if yes remove
dpkg -l | grep php
# php
LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php
# nginx
LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/nginx-mainline
# update apt
sudo apt-get update
# mysql
sudo apt-get install mysql-server mysql-client
systemctl status mysql
sudo mysql_secure_installation
# disable safe mode
# https://askubuntu.com/questions/811831/whats-the-correct-way-to-revert-mysql-5-7-strict-mode-back-to-how-it-was-in-5-6
sudo service mysql restart
# php
sudo apt-get install php7.2-fpm php7.2-cli php7.2-common \
php7.2-mysql php7.2-xml php7.2-mbstring \
php7.2-gd php7.2-json php7.2-curl
systemctl status php7.2-fpm.service
php -v
# nginx
sudo apt-get install nginx nginx-doc
sudo systemctl enable nginx
sudo systemctl start nginx
sudo systemctl status nginx
# config
cp /etc/nginx/sites-available/default ~/Backups/nginx/
# sudo mcedit /etc/nginx/sites-available/default to config attached
# _etc_nginx_sites-available_default
sudo nginx -t
sudo systemctl reload nginx
# phpinfo() ;-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment