Manual WordPress Installation on Debian 12

# Manual WordPress Installation on Debian 12

A manual WordPress installation is useful when you want to understand the components behind a self-hosted site instead of depending on a one-click installer. The source article outlines a Debian 12 deployment built around Nginx, MariaDB, PHP, PHP-FPM, and the WordPress archive. That outline is practical, but it should be used as a deployment checklist rather than a block of commands to paste into an unknown server.

A real server has its own package state, service names, document roots, DNS records, and access rules. Check every value against the machine in front of you. This article retains the source workflow and its examples while making the decisions and validation points clearer.

## What this installation uses

The source workflow installs Nginx as the web server, MariaDB as the database service, and PHP with PHP-FPM to process WordPress PHP files. It places the WordPress files in `/var/www/wordpress`, creates an Nginx site file under `/etc/nginx/sites-available/`, and enables it through a link in `sites-enabled`.

Those paths are examples from the source, not universal requirements. The most important rule is consistency: the Nginx `root` directive, the directory that receives the WordPress files, ownership settings, and any later maintenance commands must refer to the same site directory.

## Before making changes

You need SSH access and sufficient privileges to install packages, edit configuration files, manage services, and write to the selected web root. The source starts with a root SSH example, `ssh root@servername`. Use the connection method permitted by your server policy, and replace `servername` with the real host name or address.

Inspect the host before installing anything. Confirm that it is Debian 12, note the PHP version available, check whether Nginx or MariaDB is already running, and identify any existing virtual hosts. Back up configuration files before editing them. If the machine already serves another site, do not assume that the default site or web root can be replaced safely.

## 1. Update packages and install the web stack

The source first updates the package lists and installed packages, then installs Nginx and starts it at boot. It installs MariaDB and a PHP package set that includes database access, graphics support, XML, multibyte strings, cURL, PHP-FPM, image processing, ZIP support, and internationalization.

“`bash
apt-get update
apt-get upgrade
apt install nginx
systemctl start nginx
systemctl enable nginx
apt install mariadb-server
apt install php php-mysql php-gd php-xml php-mbstring php-curl php-fpm php-imagick php-zip php-intl
“`

Read the package-manager output rather than assuming every package name and dependency is unchanged. The source Nginx example later points to a PHP 8.2-FPM socket. If your installation has a different PHP release, discover the matching service and socket before copying that line into an Nginx configuration.

## 2. Create the WordPress database and database user

WordPress needs a database and a database account. The original instructions connect to MariaDB with `mysql -u root -p`, create a database, create a user restricted to localhost, grant that user privileges on the WordPress database, flush privileges, and exit.

“`sql
CREATE DATABASE [wordpressdatabasename];
CREATE USER ‘[wordpressuser]’@localhost IDENTIFIED BY ‘wordpresspassword’;
GRANT ALL PRIVILEGES ON [wordpressdatabasename].* TO [wordpressuser]@localhost IDENTIFIED BY ‘wordpresspassword’;
FLUSH PRIVILEGES;
EXIT;
“`

The bracketed values are fields to replace, not literal SQL syntax. Choose a database name, account name, and unique password for the installation, then store the resulting credentials securely. Verify that the database and user exist before proceeding; those values are needed during the WordPress web installer.

## 3. Configure the Nginx site

The source creates `/etc/nginx/sites-available/wordpress`. Its server block listens on port 80, lists `www.yourdomain.com` and `yourdomain.com`, uses `/var/www/wordpress` as the document root, and specifies `index.php` among the index files. Requests for files or directories are served normally; other requests are routed to WordPress through `index.php`.

The configuration also passes PHP requests to PHP-FPM, includes the FastCGI configuration files, and denies access to `.ht` files. Before using it, replace the example domain names and verify the PHP-FPM socket. A socket path from a PHP 8.2 example is not proof that the same path exists on another host.

The source additionally changes `client_max_body_size` to `20m` inside the Nginx `http` block. That setting may be useful for the site’s uploads, but it is an operational decision. Set an upload limit that matches the site’s needs and the resources available on the server.

## 4. Enable and test the server block

After saving the site file, the source enables it with a symbolic link and checks the Nginx configuration before restarting the service.

“`bash
ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
nginx -t
systemctl restart nginx
“`

The configuration test is a required checkpoint. If `nginx -t` reports an error, correct the cited file and line before restarting Nginx. Testing first is safer than discovering a syntax error only after the web server stops serving a working site.

## 5. Review PHP-FPM settings

The source edits `/etc/php/8.2/fpm/php.ini` and provides examples for execution time, input time, upload size, and post size. These values are not universal WordPress requirements. They should be evaluated against expected uploads, available memory, and the PHP version running on the machine.

After saving PHP changes, restart the appropriate PHP-FPM service. The source uses `service php8.2-fpm restart`. On a server with another version, use its corresponding configuration path and service name. Confirm that PHP-FPM comes back successfully before continuing.

## 6. Download WordPress and set ownership

The final source steps download the current WordPress archive from WordPress.org into `/tmp`, extract it, copy the files to `/var/www/wordpress`, and assign ownership to the `www-data` user and group.

“`bash
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
“`

Once the files are in the intended directory and the web services are running, open the chosen domain in a browser and complete the WordPress installer with the database credentials created earlier. If the installer does not load, check DNS and the Nginx server name, test Nginx again, confirm the PHP-FPM socket, and then review file paths and ownership.

## Final checks

A first page load is not the only success condition. Confirm that the intended domain reaches the expected server block, that WordPress can connect to MariaDB, and that Nginx and PHP-FPM remain available after a service restart. Keep a record of package versions, edited files, database names, and verification results. That record makes later upgrades and troubleshooting far easier.

**Time-sensitive note:** package versions, repository contents, WordPress releases, PHP service paths, and server defaults change. Validate each command and configuration value on the actual Debian 12 host before using it, especially on a production or already populated server.