Skip to content

Instantly share code, notes, and snippets.

@bateller
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bateller/cc5aea0df0269a5f4a6f to your computer and use it in GitHub Desktop.
Save bateller/cc5aea0df0269a5f4a6f to your computer and use it in GitHub Desktop.
New/Old osTicket nginx settings
# Requests to /users/tickets/api/* need their PATH_INFO set, this does that
if ($request_uri ~ "^/users/tickets/api(/[^\?]+)") {
set $path_info $1;
}
# /api/*.* should be handled by /api/http.php if the requested file does not exist
location ~ ^/users/tickets/api/(tickets|tasks)(.*)$ {
try_files $uri $uri/ /users/tickets/api/http.php;
}
# /scp/ajax.php needs PATH_INFO too, possibly more files need it hence the .*\.php
if ($request_uri ~ "^/users/tickets/scp/.*\.php(/[^\?]+)") {
set $path_info $1;
}
Main part was this...
location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass 127.0.0.1:8888;
}
We didn't have the PATH_INFO being passed before
# Make sure requests to /scp/ajax.php/some/path get handled by ajax.php
location ~ ^/users/tickets/scp/ajax.php/(.*)$ {
try_files $uri $uri/ /users/tickets/scp/ajax.php;
}
# new osTicket setup
if ($request_uri ~ "^/users/tickets/api(/[^\?]+)") {
set $path_info $1;
}
location ~ ^/users/tickets/api/(?:tickets|tasks).*$ {
try_files $uri $uri/ /users/tickets/api/http.php?$query_string;
}
if ($request_uri ~ "^/users/tickets/scp/.*\.php(/[^\?]+)") {
set $path_info $1;
}
location ~ ^/users/tickets/scp/ajax.php/.*$ {
try_files $uri $uri/ /users/tickets/scp/ajax.php?$query_string;
}
# Force SSL for osTicket (added 3-18-15 by BT)
if ($scheme = http) {
rewrite ^/users/tickets/(.*)$ https://$server_name$request_uri? permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment