I've been trying to figure out why using NGNIX as a web-server the dashboard section doesn't work. With Apache there are no issues.

I followed this configuration (http://wiki.nginx.org/OSTicket)

I dont think this is working.

location ~ ^/scp/ajax.php/(.*)$ {

try_files $uri $uri/ /scp/ajax.php;

}

Here it is what I found so far:

Request URL:http://myosticket.com/scp/ajax.php/report/overview/table/groups(http://myosticket.com/scp/ajax.php/report/overview/table/groups)

Request Method

Status Code Bad Request

Request URL:http://myosticket.com/scp/ajax.php/config/scp(http://myosticket.com/scp/ajax.php/config/scp)

Request Method

Status Code Bad Request

Request URL:http://myosticket.com/scp/ajax.php/report/overview/graph?start=&period=now(http://myosticket.com/scp/ajax.php/report/overview/graph?start=&period=now)

Request Method

Status Code Bad Request

Any help would be appreciate it.

Thanks.

I use NGINX and it works fine. I did not use the config from the nginx site though. I have osTicket running in a vhost using FastCGI running through a socket.

Maybe this will help - use the logging features they will help.

Dan

This is my nginx.conf file:

user www-data www-data;

worker_processes 2;

pid /var/run/nginx.pid;

events {

worker_connections 1024;

# multi_accept on;

}

http {

include /etc/nginx/mime.types;

access_log /var/log/nginx/http.access.log;

error_log /var/log/nginx/http.error.log;

sendfile on;

tcp_nopush on;

keepalive_timeout 65;

tcp_nodelay on;

fastcgi_buffers 8 16k;

fastcgi_buffer_size 32k;

gzip on;

gzip_disable "MSIE \.(?!.*SV1)";

#SSL support

# ssl_certificate /etc/nginx/SSL/ssl-unified.crt;

# ssl_certificate_key /etc/nginx/SSL/ssl.key;

#this is where the VHOSTS are loaded

include /etc/nginx/sites-enabled/"my vhostname";

This is my NGINX virtual host entry:

server {

server_name "FQDNhostname";

listen FQDNhostname;

# listen 443; #https not using https during the test

# ssl on; #turn on SSL support

root /var/www/"MYWEBSITEname";

index index.php index.html index.htm;

#static file 404's aren't logged and expires header is set to maximum age

location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {

access_log off;

expires max;

}

location /osTicket/ {

access_log /var/log/nginx/osTicket.access.log;

error_log /var/log/nginx/osTicket.error.log;

location ~ \.php$ {

try_files $uri =404;

include fastcgi_params;

fastcgi_pass unix:/var/run/fastcgi-php2.socket;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

}

}

Thanks for posting your code, however it didn't work for me, I forgot to mention that I'm using varnish as well.

Here it its my config file.

location ~ \.php {

# for security reasons the next line is highly encouraged

try_files $uri =404;

fastcgi_param QUERY_STRING $query_string;

fastcgi_param REQUEST_METHOD $request_method;

fastcgi_param CONTENT_TYPE $content_type;

fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

# if the next line in yours still contains $document_root

# consider switching to $request_filename provides

# better support for directives such as alias

fastcgi_param SCRIPT_FILENAME $request_filename;

fastcgi_param REQUEST_URI $request_uri;

fastcgi_param DOCUMENT_URI $document_uri;

fastcgi_param DOCUMENT_ROOT $document_root;

fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;

fastcgi_param SERVER_SOFTWARE nginx;

fastcgi_param REMOTE_ADDR $remote_addr;

fastcgi_param REMOTE_PORT $remote_port;

fastcgi_param SERVER_ADDR $server_addr;

fastcgi_param SERVER_PORT $server_port;

fastcgi_param SERVER_NAME $server_name;

# If using a unix socket...

# fastcgi_pass unix:/tmp/php5-fpm.sock;

# If using a TCP connection...

fastcgi_pass 127.0.0.1;

}

Additional information

Server Oracle-Linux 6.4

PHP 5.3.3

I am running nginx version: nginx/1.4.1 and PHP Version 5.4.17 on Debian Squeeze.

I run all my applications in seperate "locations". They live in seperate directories under /var/www/websitename/

I noticed my fastcgi config has this entry:

# PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

Does running phpinfo in a file work?

<?php

phpinfo();

?>

Once I got Nginx working I kept all the static fastcgi directives in a seperate file and just use

include fastcgi_params;

in my vhost configs resulting in much smaller config files.

These are my fastcgi params:

fastcgi_param QUERY_STRING $query_string;

fastcgi_param REQUEST_METHOD $request_method;

fastcgi_param CONTENT_TYPE $content_type;

fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_FILENAME $request_filename;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

fastcgi_param REQUEST_URI $request_uri;

fastcgi_param DOCUMENT_URI $document_uri;

fastcgi_param DOCUMENT_ROOT $document_root;

fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;

fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;

fastcgi_param REMOTE_PORT $remote_port;

fastcgi_param SERVER_ADDR $server_addr;

fastcgi_param SERVER_PORT $server_port;

fastcgi_param SERVER_NAME $server_name;

fastcgi_param HTTPS $https;

# PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

2 months later

Hi,

maybe it's a bit late to answer now, but i've gotten the same problem.

After some searching, i've found the following patch to fix some nginx issues with osticket (when ajax is active or using the api), which fixes the problem for me:

https://github.com/osTicket/osTicket-1.7/issues/538#issuecomment-16049117(https://github.com/osTicket/osTicket-1.7/issues/538#issuecomment-16049117)

Hope this helps.

a year later

Also maybe too late, but I had the same "undefined400" problem on the user side of osTicket in 1.9.5.1 and 1.9.6 - after reading all the forum threads, this seemed to be the best one in which to reply.Here's the nginx incantations that worked for me: # Requests to /api/* need their PATH_INFO set.

if ($request_uri ~ "^/api(+)") {

set $path_info $1;

}

# /api/*.* should be handled by /api/http.php if the requested file does not exist

location ~ ^/api/(?|tasks).*$ {

try_files $uri $uri/ /api/http.php?$query_string;

}

# ajax.php needs PATH_INFO too (possibly more files need it hence the .*\.php)

if ($request_uri ~ "^/scp/.*\.php(+)") {

set $path_info $1;

}

if ($request_uri ~ "^/.*\.php(+)") {

set $path_info $1;

}

# Make sure requests to ajax.php/some/path get handled

location ~ ^/scp/ajax.php/.*$ {

try_files $uri $uri/ /scp/ajax.php?$query_string;

}

location ~ ^/ajax.php/.*$ {

try_files $uri $uri/ /ajax.php?$query_string;

}

location ~ \.php$ {

# fastcgi_split_path_info ^(.+\.php)(/.+)$;

try_files $uri =404;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

fastcgi_param PATH_INFO $path_info;

include fastcgi_params;

Note that setting PATH_INFO for the user-side /ajax.php was what finally did the trick.

6 months later

I attempted to setup OSTicket 1.9.12 on new CentOS 7 install running Ajenti Control Panel. I have looked through all of the previously posted configurations and nothing seems to work.I can install OSTicket, login without an issue, but I get a ton of Ajax request issues with 404 Not found errors. Specifically relating to /scp/ajax.php/config/scp, I know this has to do with dynamic rewrites.If I use any of the above code Ajenti gives me errors starting Ngnix. I am not sure if I just need to figure out how to adapt the provided fixes to work with Ajenti but any help/insight someone can provide would be great.

nginx is not a supported webserver.  There are a number of git hub threads about issue with using osTicket with it and how to resolve them. I'd recommend that you start there.https://github.com/osTicket/osTicket-1.8/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+nginxThese two seem more pertinent.https://github.com/osTicket/osTicket-1.8/issues/2467https://github.com/osTicket/osTicket-1.8/issues/382Also if your running CentOS disable SELinux and see if that helps any.  If it does then you would want to write rules for your implementation.

a year later

Hi everybody,I'm newby using nginx , I've always used Apache, and it's difficult to me to configure the nginx.conf with osticket.I've istalled Winginx package, I've modificate my nginx.conf (as attached below) in the way to acces to "scp/index.php" . I've put an echo test to be sure that the location goes to scp/index.php. I have the "test" message displayed but not images or login form. anyone could help me with this please. 

You would have to consult the nginx links above in this thread.  That's is the extend to my knowledge about nginx as I do not run it myself.

Write a Reply...