KREST API on nginx

Hi,

I’ve been working on getting SpiceCRM installed on nginx/PHP fpm.

I’ve downloaded KREST and the mobile module and installed them within the module loader.

In order to get the KREST test JSON to be returned correctly (from the crmsite.com/KREST/sysinfo test) I added this to my nginx site config:

  autoindex off;
  location /KREST/ {
    if (!-e $request_filename){
       rewrite ^(.*)$ /KREST/index.php break;
    }

    try_files index.php?$query_string =404;
    allow all;

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 300;
    include fastcgi_params;
  }

Unfortunately even though that works, when I use the SpiceCRM mobile app I get:

‘Error Conencting’ (sic)

’ … Please ensure the url is correct and KREST extension is loaded …’

From modules it says that the KREST API is installed and the JSON from the sysinfo command seems to indicate that.

Anyone have any hints/thoughts?

for mobile you need to load a KREST extension. http://www.spicecrm.io/downloads/ lists the downloads and you can load and install teh mobile extension. I woudl assume that is missing.

No, like I said in my post, “I’ve downloaded KREST and the mobile module and installed them within the module loader.”

I’m not sure what else is needed?

can you send me the url via email to info@spicecrm.io

Sent you an email to that address

your rewite rules are too strict. If no subpath is entered so calling just http:///KREST sysinfo needs to be returned. This should return what is sent when inly index.php is called. The mobile client is maing that call and that end up with no response. So please adopt your rewite rules accordingly.

Ok… I tried doing that. I have the CRM url returning with the results of sysinfo even if the request is https://site.crm.com/KREST/

Mobile App works :slight_smile:

Here’s the updated rules, for completeness:

  autoindex off;
  location /KREST {
    if ($request_uri = "/KREST/") {
      rewrite ^/.* /KREST/sysinfo;
    }
    if ( !-e $request_filename ){
      rewrite ^(.*)$ /KREST/index.php break;
    }

    try_files index.php =404;
    allow all;

    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_read_timeout 300;
    include fastcgi_params;
  }