You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Are you tired of using Commercial ticketing system?. In this tutorial, I will show you how to install osTicket on Ubuntu 18.04 Bionic Beaver, using a LEMP stack, with Nginx as a web server, MySQL/MariaDB as a database server and PHP 7.2.

osTicket is an open source ticket system often used for support. It is written in PHP and it comes with a  simple and intuitive web interface used to manage, organize, track and archive all support ticket requests in your company. Follow steps in this guide to Install osTicket on your Ubuntu 18.04 server.

All features of osTicket are available on the official osTicket feature page.

How to Install osTicket on Ubuntu 18.04 Bionic Beaver

Below are the steps to Install osTicket on Ubuntu 18.04.

Step 1: Update system

Start by updating packages on your system to the latest release.

$ sudo apt-get update
$ sudo apt-get upgrade

You can also set server hostname ( Optional)

$ sudo hostnamectl set-hostname

Step 2: Install and Configure MySQL / MariaDB database

You will need one MySQL database with a valid user, password, and hostname handy during installation. MySQL user specified need to have FULL privileges on the database created. if you don’t have a database server installed already, check our guide on how to Install MariaDB 10.3 on Ubuntu 18.04 and CentOS 7.

After the MariaDB/MySQL server has been installed, proceed to create a database for osTicket. Login to your database server as root user and create a database for osTicket:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 19258
Server version: 10.3.7-MariaDB-1:10.3.7+maria~bionic-log binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database osticket_db;
MariaDB [(none)]> grant all privileges on osticket_db.* to osticket_user identified by "strongpassword";
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

Once the database is ready, proceed to install nginx web server:

Step 3: Installing Nginx on Ubuntu 18.04

On Ubuntu, you can install nginx from the official apt repository:

$ sudo apt-get install nginx

To start the service manually, run:

$ sudo systemctl start nginx

Though the service is enabled to start on boot by default, manually allowing it you have to run:

$ sudo systemctl enable nginx

Step 3: Install PHP and PHP-FPM

The next step is the to install php and php-fpm. Unlike Apache web server, Nginx does not contain native PHP processing. For that, we have to install PHP-FPM (FastCGI Process Manager) using the commands:

$ sudo apt-get install php \

The version of php that will be installed from this is v7.2. Php socket is located on /var/run/php/ directory. For version 7.2 of php, this is located on,/var/run/php/php7.2-fpm.sock you can confirm this the file./etc/php/7.2/fpm/pool.d/www.conf The service will be started by default, and its name is php7.2-fpm.service

Step 4: Download and Install osTicket

At this point, you should be ready to download the latest release of osTicket. Then uncompress the files and place a directory of your choice on the server web document root. As of this writing, the latest release of osTicket is.v1.10.1 Please confirm the current version before downloading it.

$ sudo apt-get install wget unzip
$ wget
$ unzip

You will get two directories after extraction: scripts and upload

$ ls -1

Create web directory for osTicket and mv these directories to it.

$ sudo mkdir /srv/osticket
$ sudo mv scripts upload /srv/os-ticket

Next create an osTicket configuration file:

$ sudo su -
# cd /srv/osticket/upload/include
# cp ost-sampleconfig.php ost-config.php

Change ownership of osTicket web directory to userwww-data and group.

$ sudo chown -R www-data:www-data /srv/osticket/

Step 5: Configure nginx

Create VirtualHost configuration file for osTicket on nginx configurations directory:

# vim /etc/nginx/conf.d/osticket.conf

Add content:

server {
listen 80;
root /srv/osticket/upload;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
index index.php index.html index.htm;

# Enable gzip
gzip on;
gzip_min_length 1000;
gzip_types text/plain application/x-javascript text/xml text/css application/xml;

set $path_info "";

location ~ /include {
deny all;
return 403;

if ($request_uri ~ "^/api(/[^\?]+)") {
set $path_info $1;

location ~ ^/api/(?:tickets|tasks).*$ {
try_files $uri $uri/ /api/http.php?$query_string;

if ($request_uri ~ "^/scp/.*\.php(/[^\?]+)") {
set $path_info $1;

location ~ ^/scp/ajax.php/.*$ {
try_files $uri $uri/ /scp/ajax.php?$query_string;

location / {
try_files $uri $uri/ index.php;

location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;

Replace with your domain name.

Confirm config syntax:

# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart nginx:

$ sudo systemctl restart nginx

Step 5: Install and configure osTicket

Now that everything is set, let’s finish the installation by setting up osTicket from UI.  open in your favorite web browser. The first page will look like below:

Confirm that all requirements are satisfied and click Continue.

Fill all required information and click “Install Now” button.

On successful installation, you will get below page:

Now change the permission of ost-config.php to remove write access as shown below.

# cd /srv/osticket/upload/
# chmod 0644 include/ost-config.php

Also, remove setup directory:

cd /srv/osticket/upload
rm -rf setup/

Take note of all your access URLs.


To log in to backend system ( Staff control panel), use

If you get an error “Valid CSRF Token Required“, use this patch –>

You need to edit:


Look for the line:

 catch (DoesNotExist $e) {
            $this->data = new SessionData(['session_id' => $id]);

Then add $this->data->session_data = "";

The whole block will look like:

catch (DoesNotExist $e) {
            $this->data = new SessionData(['session_id' => $id]);
            $this->data->session_data = "";

Now try to access Your Staff Control Panel:

Next, we will look at how to secure osTicket with Letsencrypt SSL certificate.

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF