How to install Textpattern CMS with Nginx on Debian 10

How to install Textpattern CMS with Nginx on Debian 10

Textpattern is a free and open source PHP content management system. It’s quite lightweight, fast and easy to use, while providing good customizability through themes and plugins. In this guide, we will install Textpattern on a new Debian 10 instance.


  • A fresh Debian 10 system where you can access the root user or any user with sudo privileges.
  • A registered domain name pointing to your server.

If you are logged in as the sudo user, switch to the root user for this setup:

sudo su -

Set the $ VISUAL environment variable to your favorite text editor. For example, to use nano:

echo "export VISUAL=nano" >> ~/.profile
. ~/.profile

Step 1: Install the required software.

Update the package cache on your system:

apt update

Then install Nginx, PHP-FPM, required PHP extensions, MariaDB and certbot:

apt install -y nginx mariadb-server php-fpm php-xml php-mysql php-json php-mbstring php-zip certbot

Make sure Nginx and MariaDB services are enabled and running:

systemctl enable --now nginx.service mariadb.service

Step 2: Textpattern download

Copy the download link (.tar.gz format) of the latest text mode version from Releases on Github and download it to the server using wget as follows:


Then unzip the archive and move the content to a location inside the webroot directory:

tar -xzf textpattern*.tar.gz
rm textpattern*.tar.gz
mv textpattern* /var/www/html/textpattern

Step 3: Database settings

First run the mysql_secure_installation script to perform basic security enhancements:


Answer the questions shown below and make sure to choose a secure password for the root user:

Enter current password for root (enter for none): 
Set root password? [Y/n] y
New password: your_password
Re-enter new password: your_password
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Next, we will create a database and user for Textpattern. Log in to the MySQL shell using the following command:

mysql -u root -p

Enter your root password and issue the following statement. Make sure to replace textpattern_user_password with the correct password.

MariaDB [(none)]> CREATE DATABASE textpattern_db;
MariaDB [(none)]> CREATE USER textpattern_user IDENTIFIED BY 'textpattern_user_password';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON textpattern_db.* TO textpattern_user;
MariaDB [(none)]> q

Step 4: Nginx configuration

First, get an SSL certificate for your domain by running:

certbot certonly --webroot --webroot-path /var/www/html -d "your_domain" -m "[email protected]"

Assuming your domain is configured correctly, certbot will automatically get a certificate, which we will use to configure HTTPS.

Next, disable the default Nginx server configuration file:

rm /etc/nginx/sites-enabled/default

Then open a new configuration file under / etc / nginx / sites-available:

$VISUAL /etc/nginx/sites-available/textpattern

And enter the following sensible configuration, replacing your_domain with your domain name:

server {
  listen 80;
  #replace your_domain below
  server_name your_domain;
  return 301 https://$server_name$request_uri;
server {
  listen 443 ssl;
  #replace your_domain below
  server_name your_domain;
  root /var/www/html/textpattern;
  index index.php;
  ssl on;
  #replace your_domain below
  ssl_certificate /etc/letsencrypt/live/your_domain/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/your_domain/privkey.pem;
  location ~* .php$ {
    fastcgi_pass unix:/run/php/php7.3-fpm.sock;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;

Note that this configuration redirects all HTTP requests to HTTPS. If you have specific preferences or requirements, you may need to modify them. When you are satisfied with it, create a symbolic link in your site-enabled directory:

ln -s /etc/nginx/sites-available/textpattern /etc/nginx/sites-enabled/

Then check for syntax errors using:

nginx -t

Finally, issue the following command to load the new configuration:

systemctl reload nginx.service

Step 5: Textpattern configuration

Your Textpattern installation should now be accessible, but not configured. Browse to https: // your_domain / textpattern / setup / to launch the web installer. After selecting the language, enter the database details:

  • MySQL username: textpattern_user
  • MySQL password: Enter the password selected for textpattern_user in step 2.
  • MySQL server: localhost
  • MySQL database: textpattern_db
  • Table prefix: leave blank

The installer checks the database credentials entered before generating the appropriate configuration. Create the required files:

$VISUAL /var/www/html/textpattern/textpattern/config.php

Paste the generated configuration, save the file and exit. Proceed to the next step in the web installer and you will be asked to enter information for your CMS administrator account and site configuration. When done, delete the installation directory:

rm -rf /var/www/html/textpattern/textpattern/setup

And give Nginx system users ownership of directories where Textpattern needs write access:

chown -R www-data /var/www/html/textpattern/{files,images,themes}

Your Textpattern website is now ready for use. You can access the management interface via https: // your_domain / textpattern.

More information

  • Learn about managing certificates with certbot in this guide