
Step 1: ssh login to Debian OS
ssh root@servername
Step 2: Install nginx, mariadb, php
1. Update the source first
apt-get update
apt-get upgrade
2. Install nginx
apt install nginx
systemctl start nginx
systemctl enable nginx
apt install mariadb-server
3. Install php and its add-ons
apt install php php-mysql php-gd php-xml php-mbstring php-curl php-fpm php-mysql php-imagick php-zip php-intl
Step 3: Configure the mariadb database
1. Log in to the database with an empty initial root password for mariadb.
mysql -u root -p
2. Creation of a default database
CREATE DATABASE [wordpressdatabasename].
3. create wordpress database account
CREATE USER '[wordpressuser]'@localhost IDENTIFIED BY 'wordpresspassword';
4. Granting access to the database
GRANT ALL PRIVILEGES ON [wordpressdatabasename]. * TO [wordpressuser]@localhost IDENTIFIED BY 'wordpresspassword';
FLUSH PRIVILEGES.
EXIT.
Step 4: Configure the nginx service
1. In nginx create and modify the wordpress configuration file
nano /etc/nginx/sites-available/wordpress
The configuration file is as follows:
server {
listen 80; server_name
server_name www.yourdomain.com yourdomain.com;
root /var/www/wordpress.
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args; }
}
location ~ .php$ {
include snippets/fastcgi-php.conf; } location ~ .
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; } location ~ .php$ { include snippets/fastcgi-php.conf.
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.ht {
deny all; }
}
2. Edit the nginx global configuration file
nano /etc/nginx/nginx.conf
Modify the http{} node
increase
client_max_body_size 20m;
3. Link the wordpress configuration file to the site configuration folder
ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
4. Testing for correct configuration
nginx -t
systemctl restart nginx
Step 5: Configure PHP
Edit php configuration file
nano /etc/php/8.2/fpm/php.ini
Modify the following parameters:
max_execution_time = 1200
max_input_time = 1200
upload_max_filesize = 200M
post_max_size = 800m
Restart php service
service php8.2-fpm restart
Step 6: Download and install wordpress
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
cp -a /tmp/wordpress/. /var/www/wordpress
chown -R www-data:www-data /var/www/wordpress