How to Install osTicket with Nginx on Ubuntu 18.04 LTS

screenshot from 2019 12 01 13 42 44

How to Install osTicket with Nginx on Ubuntu 18.04 LTS

osTicket is an open-source ticketing system on the Linux platform written in PHP. It supports different types of databases like MySQL, PostgreSQL and can integrate with LDAP/Active directory for central authentication.

It is a simple and lightweight web-based application. OsTicket allows you to manage, organize and archive your support request. It seamlessly routes inquiries created via email, web-forms, and phone calls into a simple, easy-to-use, multi-user, web-based customer support platform.

In this tutorial, I will show you how to install osTicket on Ubuntu 18.04, using Nginx as a web server, MySQL/MariaDB as a database server and PHP.


  • Ubuntu 18.04
  • A sudo user with root privileges.

Step 1: Getting Started

First, log in to your server with sudo privileges and update the system with the latest stable version using the following command:
sudo apt update &&  sudo apt upgrade -y

Step 2: Install LEMP Server

OsTicket requires Web server, PHP and Database Server to be installed on your server.

Install Nginx Web Server

You can install Nginx web server by the following command:
sudo apt install nginx -y

Now let’s check Nginx service and To start the service manually, run the following commands:
sudo systemctl status nginx
sudo systemctl start nginx

Now enable nginx service to start at boot time by running the following command:
sudo systemctl enable nginx

Install PHP and PHP-FPM

Next, you need to install PHP, PHP-FPM and some additional PHP modules which are required for OsTicket to run properly:
sudo apt install php php-mysql php-cgi php-fpm php-cli php-curl php-gd php-imap php-mbstring php-xml-util php-intl php-apcu php-common php-gettext php-bcmath

Above command will install php-7.2

Now edit php.ini file by running following command in terminal.
sudo vim /etc/php/7.2/fpm/php.ini

Uncomment cgi.fix_pathinfo variable and change its value to 0

Now save and close the file.

Next, restart php7.2-fpm service and enable it at startup using the following command:
sudo systemctl restart php7.2-fpm
sudo systemctl enable php7.2-fpm

Install and Configure MySQL Database server for OsTicket

From your terminal window, issue the following command to install the MySQL database server.
sudo apt install mysql-server

Now start MySQL service and enable it to start at boot time then check MySQL service status with the following command:-
sudo systemctl start mysql
sudo systemctl enable mysql
sudo systemctl status mysql

Next, secure MySQL installation with the following command:
sudo mysql_secure_installation

Answer all the questions as below:

Set root password? [Y/n] Y
New password:
Re-enter new 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, log in to MySQL console as shown below:

sudo mysql -u root -p

Enter your Root password here.

Now you need to create the database for osTicket
run following command
mysql> create database osticket_db;

mysql> grant all privileges on osticket_db.* to osticket_user identified by 'OsTicketPassw0rd@19';

mysql> flush privileges;

A database for osTicket has been created.

Step 3: Download and Configure osTicket

Create a new directory for osTicket and then go to that directory.
sudo mkdir -p /var/www/osticket/
cd /var/www/osticket/

Next download latest osTicket setup using wget and Extract it using the following command:-
sudo apt-get install wget unzip
sudo wget https://github.com/osTicket/osTicket/releases/download/v1.14.1/osTicket-v1.14.1.zip
sudo unzip osTicket-v1.14.1.zip

You will get scripts and upload directory after extracting.

Next create an osTicket configuration file from ost-sampleconfig.php file using the following command:
sudo su -
cd upload/
cp ost-sampleconfig.php ost-config.php

Next, you need to change ownership of the osTicket web directory to the ‘www-data’ user and group.
sudo chown -R www-data:www-data /var/www/osticket/

Step 4 – Create OsTicket Virtual Host

Now create new virtual host configuration for OsTicket by running following command:
sudo vim /etc/nginx/sites-available/osticket.conf

Paste the configuration as below:
server {
listen 80;
server_name; ## change server_name as per your domain name.
root /var/www/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;

Here, You need to change server_name as per your domain name.

Save the Nginx configuration file and exit.

Now activate the virtual host and test the configuration.
ln -s /etc/nginx/sites-available/osticket.conf /etc/nginx/sites-enabled/
nginx -t

This will show output as below

Test nginx Configuration

Now restart nginx service
sudo systemctl restart nginx

Step 5: Install and configure osTicket

Now let’s enter your domain name to get osTicket UI in any web browser, you will see a page like below:

osTicket installer

Next Click on ‘Continue‘ and you will be redirected to the osTicket configuration section.

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

system settings

In the database settings, enter details as dbname, username, and password you have created during mysql setup.

Database settings

At last Click on Install Now button, when Installation completed it will show screenshot like below:

osTicket installation successful

Next, change the permission of ost-config.php to remove write access by running the following command:
cd /var/www/osticket/upload/
chmod 0644 include/ost-config.php

For osTicket admin type your IP/domain name in the web browser:

osTicket Login

For admin login/agent panel/Admin panel configuration type as following.

Finally, you have successfully installed osTicket on Ubuntu 18.04 server.

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !