Add init
This commit is contained in:
54
init
Normal file
54
init
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash +x
|
||||||
|
|
||||||
|
# Enable nginx to start with system
|
||||||
|
sudo systemctl enable --now nginx
|
||||||
|
sudo systemctl status nginx
|
||||||
|
|
||||||
|
# Setup nginx
|
||||||
|
sudo rm /etc/nginx/sites-enabled/default
|
||||||
|
sudo ln -s nginx/wordpress /etc/nginx/sites-available
|
||||||
|
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress
|
||||||
|
|
||||||
|
# Check for error
|
||||||
|
sudo nginx -t
|
||||||
|
|
||||||
|
# Restart nginx after loading wordpress config
|
||||||
|
sudo systemctl restart nginx
|
||||||
|
|
||||||
|
# PHP
|
||||||
|
sudo systemctl enable --now php8.4-fpm
|
||||||
|
|
||||||
|
# Change 999G if you want some sort of limit
|
||||||
|
sudo sed -i "s/^post_max_size = 8M/post_max_size = 999G/g" /etc/php/8.4/fpm/php.ini
|
||||||
|
sudo sed -i "s/^upload_max_filesize = 2M/upload_max_filesize = 999G/g" /etc/php/8.4/fpm/php.ini
|
||||||
|
|
||||||
|
# Change 99 to something lower if you want some sort of limit
|
||||||
|
sudo sed -i "s/^pm = dynamic/pm = ondemand/g" /etc/php/8.4/fpm/pool.d/www.conf
|
||||||
|
sudo sed -i "s/^pm.max_children = 5/pm.max_children = 99/g" /etc/php/8.4/fpm/pool.d/www.conf
|
||||||
|
|
||||||
|
# Start php-fpm
|
||||||
|
sudo systemctl restart php8.4-fpm
|
||||||
|
|
||||||
|
# MariaDB
|
||||||
|
sudo systemctl enable --now mariadb
|
||||||
|
# Secure MariaDB
|
||||||
|
|
||||||
|
# Set the Root Password
|
||||||
|
mysql -u root <<EOF
|
||||||
|
UPDATE mysql.user SET Password=PASSWORD('$MYSQL_ROOT_PASS') WHERE User='root';
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Secure installation options (this is just an example; customize as needed)
|
||||||
|
mysql -u root -p$MYSQL_ROOT_PASS <<EOF
|
||||||
|
DELETE FROM mysql.user WHERE User='';
|
||||||
|
DROP DATABASE IF EXISTS test;
|
||||||
|
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
|
||||||
|
SET PASSWORD FOR 'root'@'localhost'=PASSWORD('$MYSQL_NEW_PASS');
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Remove anonymous users, disable root login remotely, and remove the test database
|
||||||
|
echo "Secure installation completed."
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user