Step-by-Step Ubuntu Server Setup for Production OJS Publishing
A terminal-level deployment walkthrough for configuring Ubuntu Server for OJS. Step-by-step commands for system hardening, firewall rules, PHP-FPM configuration, and MariaDB setup.
Real Problem
Many journals suffer from catastrophic ransomware attacks or unauthorized manuscript leaks because their Linux servers were provisioned with root logins, open MySQL ports, and improper web root permissions.
Practical Solution
Follow this comprehensive terminal guide to configure a secure Ubuntu 22.04 or 24.04 LTS server with UFW, SSH key authentication, Nginx, MariaDB, PHP-FPM, and an isolated files directory.
Initial System Provisioning and Server Hardening
When spinning up a fresh VPS or dedicated physical server for Open Journal Systems, security begins at the base operating system level. Log in as root and immediately update package indices:
apt update && apt upgrade -y
Create a dedicated system administrator user with sudo privileges and immediately disable direct root SSH logins:
adduser ojsadmin
usermod -aG sudo ojsadmin
Edit /etc/ssh/sshd_config to set PermitRootLogin no and PasswordAuthentication no, requiring cryptographic SSH key pairs for all future terminal connections. Restart the SSH daemon:
systemctl restart ssh
Firewall Rules with UFW
Lock down all unneeded server ports using the Uncomplicated Firewall (UFW). Only SSH, HTTP, and HTTPS should be accessible from the public internet:
ufw default deny incoming
ufw default allow outgoing
ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable
Installing Nginx Web Server and High-Performance PHP-FPM
Install the Nginx web server alongside PHP-FPM and required extensions:
apt install -y nginx software-properties-common
add-apt-repository ppa:ondrej/php -y
apt update
apt install -y php8.1-fpm php8.1-cli php8.1-mysql php8.1-xml php8.1-mbstring php8.1-curl php8.1-gd php8.1-intl php8.1-zip php8.1-bcmath
Configure the PHP-FPM pool in /etc/php/8.1/fpm/pool.d/www.conf. Adjust pm = dynamic, pm.max_children = 50, pm.start_servers = 10, pm.min_spare_servers = 5, and pm.max_spare_servers = 20 based on available server RAM. Restart PHP-FPM:
systemctl restart php8.1-fpm
Securing MariaDB for Academic Workloads
Install MariaDB Server:
apt install -y mariadb-server
mysql_secure_installation
Create the OJS database and dedicated database user with strict UTF-8 Unicode character support:
mysql -u root -p
CREATE DATABASE ojs_database CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'ojs_user'@'localhost' IDENTIFIED BY 'StrongGeneratedPasswordHere';
GRANT ALL PRIVILEGES ON ojs_database.* TO 'ojs_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Directory Structure and Outside-Webroot Provisioning
Create two primary directory trees: the web application root and the secure manuscript files repository:
mkdir -p /var/www/ojs
mkdir -p /var/ojs_files
Download the verified OJS release tarball from the Public Knowledge Project and extract it into /var/www/ojs. Set proper Linux ownership and security permissions:
chown -R www-data:www-data /var/www/ojs
chown -R www-data:www-data /var/ojs_files
chmod -R 755 /var/www/ojs
chmod -R 750 /var/ojs_files
Automating Scheduled Tasks via System Cron
OJS requires scheduled tasks to send reminder emails to overdue peer reviewers, process Crossref deposits, and execute acron triggers. Add a system cron entry under the web user:
crontab -u www-data -e
Add the line:
0 * * * * php /var/www/ojs/tools/runScheduledTasks.php > /dev/null 2>&1
Step-by-Step Action Plan
System Updates & User Hardening
Update package repositories, create a dedicated sudo user, and disable root SSH login and password authentication in sshd_config.
Firewall Configuration with UFW
Enable UFW and allow only OpenSSH (port 22), HTTP (port 80), and HTTPS (port 443).
Install Nginx Web Server
Install Nginx mainline/stable and configure server blocks with optimized buffers and gzip compression.
Deploy PHP-FPM Runtime
Install PHP 8.1 or 8.2 with all PKP-required extensions and tune pool directives.
Install & Secure MariaDB
Execute mysql_secure_installation, set strong root passwords, and create the ojs_db database.
Set Up Isolated Storage & Cron
Create /var/ojs_files outside web root, assign www-data ownership, and configure crontab for scheduled tasks.
Questions People Usually Ask
Which Ubuntu version is best for OJS production?
Ubuntu 22.04 LTS (Jammy Jellyfish) or Ubuntu 24.04 LTS (Noble Numbat) are the premier recommendations due to 5-year security maintenance, modern kernel performance, and robust package availability.
Should I install phpMyAdmin on my production OJS server?
We strongly discourage installing phpMyAdmin on public production servers as it is a frequent target for automated brute-force attacks. Instead, manage databases securely via SSH tunneling or native CLI.
How do I handle automated system updates without breaking OJS?
Configure the unattended-upgrades package for security patches only, while pinning PHP and MySQL packages to prevent unintended major version jumps that could disrupt OJS compatibility.
Let AcademiaTech Configure Your Academic Server
Save hundreds of hours of trial-and-error by letting our certified Linux engineers deploy and harden your production OJS server stack.