sudo apt update
sudo adduser newuser
sudo usermod -aG sudo newuser
sudo usermod -aG www-data newuser
sudo usermod -aG staff newuser
sudo apt install nginx-full
sudo ufw allow 'Nginx HTTP'
sudo ufw allow 'Nginx HTTPS'
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
sudo apt install mysql-server
sudo mysql_secure_installation
when it asks for "Do you wish to continue with the password provided?" => says "No"
CREATE DATABASE db_name;
CREATE USER 'john'@'localhost' IDENTIFIED WITH mysql_native_password BY 'johnpassword';
GRANT ALL PRIVILEGES ON db_name.* TO 'john'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
sudo apt install php-fpm php-mysql php-gd php-zip php-bcmath php-tokenizer
sudo vi /etc/php/7.4/fpm/php.ini
# find upload_max_filesize and post_max_size
server {
listen 80;
server_name your-domain-name.com;
root /sites/your-domain/wordpress;
index index.php index.html;
client_max_body_size 100M;
# prevent call direct php file.
location = /wp-includes/js/tinymce/wp-tinymce.php {
try_files $uri $uri/ =404;
}
# prevent call direct php file.
location ~* /wp-content/.*.php {
deny all;
access_log off;
log_not_found off;
return 404;
}
# prevent call direct php file.
location ~* /wp-includes/.*.php {
deny all;
access_log off;
log_not_found off;
return 404;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}