Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu: php-fpm, nginx, mariadb, ssh
#scp ~/.ssh/id_rsa.pub root@255.255.255.255:~
# [ -d ~/.ssh ] || (mkdir ~/.ssh; chmod 711 ~/.ssh)
# cat ~/id_rsa.pub >> ~/.ssh/authorized_keys
# chmod 600 ~/.ssh/authorized_keys
# rm ~/id_rsa.pub
apt install -y software-properties-common
add-apt-repository ppa:ondrej/php
# add-apt-repository universe
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sh -c "echo 'deb [arch=amd64,i386] https://mirrors.evowise.com/mariadb/repo/10.2/ubuntu '$(lsb_release -cs)' main' > /etc/apt/sources.list.d/MariaDB-10.2.list"
apt update && apt upgrade
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
apt install -y vim fail2ban nodejs nginx htop curl zip unzip supervisor git git-flow mariadb-server mariadb-client letsencrypt redis-server php7.4 php7.4-fpm php7.4-common php7.4-mysql php7.4-gd php7.4-curl php7.4-cli php7.4-mbstring php7.4-xml php7.4-zip php7.4-intl php-redis
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
# vi /etc/ssh/sshd_config
# > Port 5544
# systemctl restart sshd
# vi /etc/redis/redis.conf
# > maxmemory 512mb
# > maxmemory-policy allkeys-lfu
# groupadd customuser
# useradd -g www-data -G customuser -s /bin/bash -m customuser
# passwd customuser
# mysql -u root -p
# > CREATE DATABASE customuser;
# > CREATE USER 'customuser'@'localhost' IDENTIFIED BY 'NEW PASS';
# > GRANT ALL PRIVILEGES ON customuser.* TO 'customuser'@'localhost' WITH GRANT OPTION;
# > FLUSH PRIVILEGES;
# > exit;
# sudo certbot certonly --agree-tos -d domain.com --preferred-challenges dns --manual --server https://acme-v02.api.letsencrypt.org/directory
# sudo letsencrypt certonly -a webroot --webroot-path=/home/.../public -d domain.com
# Cloudflate https://www.bjornjohansen.com/wildcard-certificate-letsencrypt-cloudflare
# /root/.secrets/cloudflare.ini
# chmod 0700 /root/.secrets/
# chmod 0400 /root/.secrets/cloudflare.ini
# > dns_cloudflare_email = "youremail@example.com"
# > dns_cloudflare_api_key = "4003c330b45f4fbcab420eaf66b49c5cbcab4"
# add-apt-repository ppa:certbot/certbot
# apt-get update
# apt-get install certbot python-certbot-nginx python3-certbot-dns-cloudflare
# certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/cloudflare.ini -d example.com,*.example.com --preferred-challenges dns-01
# crontab -e
# > 14 5 * * * /usr/bin/certbot renew --quiet --post-hook "/usr/sbin/service nginx reload" > /dev/null 2>&1
systemctl start redis-server
systemctl enable redis-server
systemctl restart mariadb
systemctl restart php7.4-fpm
systemctl restart nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment