|

Nginx and osTicket 1.8 configuration

Recently when switching from Apache to Nginx for osTicket 1.8, I found that some functionality does not work properly. For example, when replying to customer’s via SCP, line break character does not display properly. In addition, some ajax-based features are not worked any more. After digging a little bit, I can solve the problem with nginx configuration. So in this quick note, I will mention on how to configure nginx and osTicket 1.8 so that they can live together šŸ˜›

First, assume that we have a website athttps://www.domain.com and the osTicket 1.8 is located atĀ https://www.domain.com/support . We also configure to run the osTicket on Nginx, PHP-FPM and MariaDB stack.

In Nginx configuration, we will need to add the following configuration for osTicket to work properly:

[bash]
#– Quick fix will go with $path_info parameter
set $path_info "";
# Requests to /api/* need their PATH_INFO set, this does that
if ($request_uri ~ "^/support/api(/[^\?]+)") {
set $path_info $1;
}

# /api/*.* should be handled by /api/http.php if the requested file does not exist
location ~ ^/support/api/(tickets|tasks)(.*)$ {
try_files $uri $uri/ /support/api/http.php;
}

# /scp/ajax.php needs PATH_INFO too, possibly more files need it hence the .*\.php
if ($request_uri ~ "^/support/scp/.*\.php(/[^\?]+)") {
set $path_info $1;
}

# Make sure requests to /scp/ajax.php/some/path get handled by ajax.php
location ~ ^/support/scp/ajax.php/(.*)$ {
try_files $uri $uri/ /support/scp/ajax.php;
}

# Add trailing slash to */support requests.
rewrite /support$ $scheme://$host$uri/ permanent;

#To access without index.php in the link
location /support/ {
try_files \$uri \$uri/ /support/index.php?$query_string;
}

# Process PHP files
location ~ \.php {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
}
[/bash]

Similar Posts

  • GitLab docker on Ubuntu

    Today I decided to move my self-hosted gitlab instance to Docker so that I will not need to reinstall and configure lots of things when migrating from one host to another host. So I blog this entry to note steps to install gitlab docker on Ubuntu. Install Docker CE (or Docker Compose if you want)…

  • Install OpenVPN server CentOS 7

    Today I will brief necessary steps for installingĀ OpenVPN server CentOS 7. This will include custom server name and also rules for csf firewall which is widely used. The OpenVPN server name in this tutorial will be myvpnserver, associated domain will be myvpnserver.myserver.com, and server IP address is XXX.YYY.ZZZ.UUU . We will user a self-signed certificate…

  • Linux, Nginx, MySQL, PHP – LEMP Stack for Laravel on Ubuntu

    This quick tutorial will guide to install LEMP stack for Laravel on Ubuntu OS. Install PHP Install necessary php mods: [bash]apt-get install nginx php5-fpm php5-cli php5-mcrypt php5-json php5-dev php-pear git[/bash] Enable mcrypt: [bash]ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available php5enmod mcrypt[/bash] Modify /etc/php5/fpm/php.ini and change cgi.fix_pathinfo to 0: [bash]cgi.fix_pathinfo=0[/bash] Install opcache: [bash]pecl install zendopcache-7.0.3 echo "zend_extension=/usr/lib/php5/20100525/opcache.so" > /etc/php5/mods-available/opcache.ini…

Leave a Reply

Your email address will not be published. Required fields are marked *