How to Install Joomla with Nginx on a Debian 10 VPS

213
Published on May 26, 2020 by

This video shows you how to install Joomla with Nginx on Debian 10 VPS. Joomla is a content management system that allows you to develop websites and publish web content easily in a user-friendly way. It is open-source, free to use and is built on a mobile-ready model–view–controller web application framework. It has thousands of features and designs, and these make it a good bet for building professional sites.

==============================
INITIAL SERVER SETUP DEBAIN 10
==============================
Login to Server:
ssh root@your_server_ip

apt update -y && apt upgrade -y

adduser debian

usermod -a -G sudo debian

Configure SSH :
nano /etc/ssh/sshd_config

Add and change the information:
Port 22500
Protocol 2
PermitRootLogin no

Add to End of File :
UseDNS no
AllowUsers debian

Save and Close

Restart SSH service:
systemctl restart ssh.service

Logout:

Ctrl+D

Login using user with sudo privilages:
ssh -p 22500 user@ip_address

==============================
INSTALL NGINX, PHP AND MARIADB
==============================
Install Nginx, MariaDB, PHP, and other PHP modules :
sudo apt install nginx mariadb-server mariadb-client php-common php-fpm php-cli php-gd php-mysql php-intl php-zip php-mbstring php-json php-xml php-xmlrpc php-curl unzip wget git curl -y

Open the php.ini file:
sudo nano /etc/php/7.3/fpm/php.ini

Make the following changes:
post_max_size = 256M
memory_limit = 512M
max_execution_time = 300
upload_max_filesize = 128M
output_buffering = Off
date.timezone = America/Chicago //optional

using sed:
sed -i "s/post_max_size = .*/post_max_size = 256M/" /etc/php/7.3/fpm/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.3/fpm/php.ini
sed -i "s/max_execution_time = .*/max_execution_time = 300/" /etc/php/7.3/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/" /etc/php/7.3/fpm/php.ini
sed -i "s/output_buffering = .*/output_buffering = Off/" /etc/php/7.3/fpm/php.ini


Save and Close :
Ctrl O+X

Restart PHP-FPM service:
sudo systemctl restart php7.3-fpm.service

==============================
CONFIGURE NGINX FOR JOOMLA
==============================
Create Document Root directory:
sudo mkdir -v /var/www/linuxscoop # change with your own root directory

sudo nano /etc/nginx/sites-available/linuxscoop.cc

------------------------------
server {
listen 80;
listen [::]:80;
root /var/www/linuxscoop;
server_name linuxscoop.cc www.linuxscoop.cc; # change with your own domain

index index.php;

charset utf-8;

access_log /var/log/nginx/linuxscoop_access.log;
error_log /var/log/nginx/linuxscoop_error.log;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ .php$ {
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}

}
------------------------------

sudo nginx -t

sudo ln -s /etc/nginx/sites-available/linuxscoop.cc /etc/nginx/sites-enabled/

sudo systemctl restart nginx.service

sudo systemctl restart php7.3-fpm.service

==============================
CONFIGURE A JOOMLA DATABASE
==============================
sudo mysql_secure_installation

mysql -u root -p

Fix when can't login as root :
https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost

CREATE DATABASE dbjoomla DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;

GRANT ALL ON dbjoomla.* TO 'joomuser'@'localhost' IDENTIFIED BY '5tR0n6p@s5WorD';

FLUSH PRIVILEGES;

EXIT;

==============================
DOWNLOAD AND INSTALL JOOMLA
==============================
cd /tmp && wget https://downloads.joomla.org/cms/joomla3/3-9-18/Joomla_3-9-18-Stable-Full_Package.zip

sudo unzip Joomla*.zip -d /var/www/linuxscoop

sudo chown -Rv www-data:www-data /var/www/linuxscoop/

cd /var/www/linuxscoop

sudo find . -type d -exec chmod 0755 {} \;

sudo find . -type f -exec chmod 0644 {} \;


==============================
INSTALL AND CONFIGURE
LET'S ENCRYPT SSL CERTIFICATE
==============================
sudo apt install python3-acme python3-certbot python3-mock python3-openssl python3-pkg-resources python3-pyparsing python3-zope.interface
sudo apt install python3-certbot-nginx
sudo certbot --nginx -d linuxscoop.cc -d www.linuxscoop.cc

Renew :
sudo certbot renew --dry-run

==============================
SETTING UP FIREWALL
==============================
sudo apt install ufw
sudo ufw enable
sudo ufw app list
sudo ufw allow 22500/tcp comment 'Open port ssh tcp port 22500'
sudo ufw allow 80
sudo ufw allow 443
sudo ufw status

==============================
COMPLETE JOOMLA SETUP
==============================
Install Drupal through Web Browser
Category Tag