
- Initial setup of Ubuntu
- LAMP stack: how-to-install-linux-apache-mysql-php-lamp-stack | how-to-install-a-lamp-stack-on-ubuntu
- PHB-Brew: github.com/phpbrew & blog/docker-php-8-zts-apache-swoole-parallel & gmp install
- LetsEncrypt: le-on-ubuntu | le-with-nginx | (on different port: here or here)
Setup Firewall : firewall-on-ubuntu | configure-firewall-and-change-ssh-port.md - After ssl , change ssh port (from
22
to your desired, i.e.12345
):sudo ufw allow 12345/tcp
And change portnano /etc/ssh/sshd_config
22
to12345
. Then doservice ssh restart
(orservice sshd restart
) You might also need to amend:/etc/apache/sites-enabled && /etc/apache2/ports.conf
- WordPress (with mysql) : do.com/wordpress-on-ubuntu
- fail2ban :
sudo apt-get install fail2ban
- Simple Disk usage show:
sudo apt install ncdu
- disable journal: se.com/how-to-clear-journalctl
journalctl --vacuum-size=100M
/etc/systemd/journald.conf
–>SystemMaxUse=100M
(sudo find /var/log/journal -name "*.journal" | xargs sudo rm) && (sudo systemctl restart systemd-journald) - Set correct permissions for multiple users
– to rewrite privileges after uploading files automatically:*/10 * * * * sudo chown -R www-data:www-data /var/www
- [PHP]:
– Install Redis Cache
– Install MBstring :sudo apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0
- Add user through SSH
- Increate timeout for SSH client
- Restrict port to specific IP:
sudo iptables -A INPUT -p tcp -s YOURRRRRRR_IPPPPPPPPPPP -j ACCEPT
sudo ufw allow from 123.123.123.123 to any port 22 proto tcp
- Monitor files/folders changes :
inotify-hookable -w path_to_plugin -c "COMMAND_TO_EXECUTE" (i.e. "docker container restart CONTAINER_NAME")
- Download & unpack file:
wget --no-check-certificate --content-disposition https://codeload.github.com/USER/REPONAME/zip/refs/heads/master -O temp.zip
&& unzip -o temp.zip -d /var/www/path/folder
- Find file:
find . -type f -name "*John*"
- Install & Configure mail: article1 | article2
- Auto- Restart stopped-service : Github repo
### MYSQL ###
- Add/Create user:
CREATE USER 'myuser1'@'192.168.1.123' IDENTIFIED BY 'password123';
GRANT ALL PRIVILEGES ON dbnamee.* TO 'myuser1'@'192.168.1.123';
FLUSH Privileges; - user password change :
ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxxxxx';
- disable mysql-logs : se.com/delete-mysql-bin-files & se.com/disable-mysql-logging
/etc/mysql/my.cnf - >
In mysql:
[mysqld]
max_allowed_packet = 512M
skip-log-bin
binlog_expire_logs_seconds=1600SHOW VARIABLES LIKE 'max_allowed_packet';
SET @@global.max_allowed_packet = 16777215;
SHOW VARIABLES LIKE 'max_allowed_packet';