Home / How To / 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 PHP content management system. It's fairly easy, fast and easy to use while providing decent customizability through themes and plugins. In this guide we will install the Textpattern in a new Debian 10. instance.


  • A new Debian 10 system where you have access to the root user or any user with sudo privileges.
  • A registered domain name points to your server.

If you are logged in as a sudo user, switch to root for this setting:

  sudo su -

Set $ VISUAL environment variable to a text editor according to your wishes. For example, to use nano:

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

Step 1
: Install required software.

Update package cache on your system:

  apt update

Then install Nginx, PHP-FPM, the necessary 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 the Nginx and MariaDB services are enabled and running:

  systemctl enable - now nginx.service mariadb.service 

Step 2: Download the textpattern

Copy the download link (in .tar.gz format) for the latest version of the textpattern from their Releases on Github and download it to your server using wget as follows:

  wget https://github.com/textpattern/textpattern/releases/ download / 4.7. 3 / textpattern-4.7.3.tar.gz

Then extract the archive and move the contents to a location in the root directory:

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

Step 3: Database setup

Start running mysql_secure_installation to perform basic security improvements:


Answer the questions that appear below and be sure to select a secure root user password:

  Enter the current root password (set for none): 
Setting root password? [Y/n] y
New password: your_password
Enter new password: your_password
Delete anonymous users? [Y/n] y
Remove root login remotely? [Y/n] y
Delete the test database and access it? [Y/n] y
Reload privilege tables now? [Y/n] y

Then we create a database and users to use by Textpattern. Log in to the MySQL shell using:

  mysql -u root -p

Enter your root password and then issue the following statements. Be sure to replace textpattern_user_password with the correct password.

  MariaDB [(none)]> CREATE DATABASE textpattern_db;
MariaDB [(none)]> CREATE USERS textpattern_user IDENTIFIED BY & # 39; textpattern_user_password & # 39 ;;
MariaDB [(none)]> GIVE 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 the following command:

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

Provided your domain is configured correctly, certbot will automatically obtain a certificate that we will use to configure HTTPS.

Then 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 reasonable configuration, and replace your_domain with your domain name:

  server {
listen 80;
# place your_domain below
server_name your_domain;
return 301 https: // $ server_name $ request_uri;
server {
listen 443 ssl;
# place your_domain below
server_name your_domain;
root / var / www / html / textpattern;
index index.php;
ssl på;
# place 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. You may want to change it if you have specific preferences or requirements. When you are happy with that, create a symbolic link in the page-enabled directory:

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

Then check for syntax errors with:

  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 available but not yet configured. Browse to https: // your_domain / textpattern / setup / to start the web installer. After selecting a language, enter database information:

  • 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 will check the database's references before generating the corresponding configuration. Create the required file:

  $ 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, where you will be asked to enter CMS administrator account information and site configuration. When done, remove directory :

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

And give the Nginx system user ownership of the directories that Textpattern needs write access to:

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

Your Textpattern site is now ready for use. The administration interface can be reached at https: // your_domain / textpattern .

More information

Source link