FAQ

Page Discussion History

Difference between revisions of "OSTicket"

(ajax.php and http.php do need PATH_INFO to process async requests (e.g. Staff creates new ticket). Also the query string is necessary, which try_files would hide if not appended manually. works fine with osTicket v1.8.0.2)
 
Line 39: Line 39:
  
 
         root /var/www/osticket;
 
         root /var/www/osticket;
 +
 +
        set $path_info "";
  
 
         location ~ /include {
 
         location ~ /include {
Line 45: Line 47:
 
         }
 
         }
  
         location ~ ^/api/(tickets|tasks)(.*)$ {
+
         if ($request_uri ~ "^/api(/[^\?]+)") {
            try_files $uri $uri/ /api/http.php;
+
    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/(.*)$ {
+
location ~ ^/scp/ajax.php/.*$ {
            try_files $uri $uri/ /scp/ajax.php;
+
    try_files $uri $uri/ /scp/ajax.php?$query_string;
        }
+
}
  
 
         location / {
 
         location / {
Line 60: Line 70:
 
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 
             include        fastcgi_params;
 
             include        fastcgi_params;
 +
            fastcgi_param  PATH_INFO $path_info;
 
             fastcgi_pass  127.0.0.1:8888;
 
             fastcgi_pass  127.0.0.1:8888;
 
         }
 
         }

Latest revision as of 11:08, 25 January 2014

http://osticket.com/

SSL setup isn't required, but I'd recommend it.

user  nginx;
worker_processes 1;
 
events {
    worker_connections  1024;
}
 
http {
    include         mime.types;
    default_type    application/octet-stream;
    sendfile        on;
    charset         utf-8;
    gzip            on;
    gzip_types      text/plain application/xml text/javascript;
    gzip_min_length 1000;
 
    index index.php index.html index.htm;
 
    # Rewrite all requests from HTTP to HTTPS
    server {
        listen 80;
        server_name tickets.mydomain.com;
        rewrite ^ https://tickets.mydomain.com permanent;
    }
 
    server {
        listen 443;
        server_name tickets.mydomain.com;
        ssl on;
        ssl_certificate /etc/nginx/certs/cert.pem;
        ssl_certificate_key /etc/nginx/certs/cert.key;
 
        keepalive_timeout 70;
 
        root /var/www/osticket;
 
        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;
            fastcgi_param  PATH_INFO	$path_info;
            fastcgi_pass   127.0.0.1:8888;
        }
    }
}