Skip to content

Instantly share code, notes, and snippets.

Last active November 30, 2023 06:02
Show Gist options
  • Save exts/e097fb92db8dda6ddabfc35302b687ea to your computer and use it in GitHub Desktop.
Save exts/e097fb92db8dda6ddabfc35302b687ea to your computer and use it in GitHub Desktop.
Fresh PHP 8.0 LEMP setup info/Ubuntu 16
## Requires newer versions of ubuntu, I'm using Ubuntu 20
# install nginx
sudo apt install nginx
# add php8.X repository
sudo add-apt-repository ppa:ondrej/php
sudo apt update
# search libraries
sudo apt search php8-*
# install libraries
sudo apt install php8.0-fpm php8.0-common php8.0-curl php8.0-mysql php8.0-gd php8.0-intl php8.0-mbstring php8.0-xml php8.0-zip php8.0-opcache php8.0-tidy php8.0-readline php8.0-imagick
# extra packages
imagemagick beanstalkd supervisord zip
# install memcache
sudo apt install libmemcached-dev memcached php-memcached
# install mysql
sudo apt install mysql-server
sudo mysql_secure_installation
# setup virtual host
cd /etc/nginx/sites-available && sudo touch
# nginx file
server {
listen 80;
root /var/www/;
index index.php index.html index.htm;
sendfile off;
location / {
try_files $uri $uri/ /index.php$is_args$args;
location ~ \.php$ {
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
# system link
sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
# install composer
cd /tmp
php -r "copy('', 'composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
Copy link

exts commented Feb 27, 2020

Mysql: fix access issue when using vagrant

sudo mysql

use mysql;`
update user set plugin='mysql_native_password' where user = 'root';
flush privileges;

Copy link

exts commented May 27, 2021

update mysql.user 
    set authentication_string=PASSWORD("PWD"), plugin="mysql_native_password" 
    where User='root' and Host='localhost';    
flush privileges;

To fix connection issues w/ root

Copy link

exts commented Oct 11, 2021

MYSQL 8.X password fix:

UPDATE mysql.user SET authentication_string=null WHERE User='root';
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'root';

Copy link

exts commented Jul 28, 2022

UNINSTALL COMPONENT 'file://component_validate_password'; antoer alternative

Copy link

exts commented May 19, 2023


ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'root';

sudo mysql_secure_installation -p using the password

THEN say no to changing the root pw. and no to security check

Copy link

exts commented Nov 30, 2023

mysql server needs at least 1GB or it won't work on digitalocean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment