rigal
31 October 2018 05:47
1
Hello,
I try to get access token Using REST API v8 but getting 404 . error.
I have change nginx conf file for rewrire rules but its not working .
location /api {
rewrite ^/api/(.*?)$ /lib/API/public/index.php/$1 break;
}
Really appreciate the help on the same.
Thanks
You get the 404 error doing what, exactly?
Anyway please be aware that SuiteCRM on nginx can work but is unsupported, so it requires a few changes to the codebase (there are other posts on the forum with details)
rigal
31 October 2018 10:50
3
Yes
Getting 404 error. Suitecrm Working fine with nginx but i think its nginx rewrite rule issue.
Thanks
To make the API work in Nginx add this to your config:
location ~ /Api/ {
index index.php;
try_files $uri @rewrite_api;
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}
location @rewrite_api {
rewrite ^/Api/(.*)?$ /Api/index.php/$1 last;
}
1 Like
what config file please? and what is its directory
It should be placed in your site configuration on your nginx webserver. /etc/nginx/sites-enabled/…
Alternatively, you may be able to use the direct URLS to the API (rather than the ‘modified nice looking ones’) as outlined in:
I guess that I ought to put the direct URLs here as well for the latest 7.10.x and 7.11.x versions of the software. The .htaccess file relies on mod_rewrite (in apache) to carry out the following URL changes:
RewriteRule ^Api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^Api/access_token$ Api/index.php/access_token [L]
RewriteRule ^Api/V8/(.*?)$ Api/index.php/V8/$1 [L]
This means that you can avoid the shortened https://mysite.com/Api/access_token and instead use the full…
This means that you can avoid the shortened https://mysite.com/Api/access_token and instead use the full path https://mysite.com/Api/index.php/access_token
Similarly for using the V8 Api, replace https://mysite.com/Api/V8/module and instead use the full path https://mysite.com/Api/index.php/V8/module