53
edits
(→Examples: warning about non-working example) |
(→Dolibarr REST web services server: nginx setup) |
||
| Line 26: | Line 26: | ||
= Dolibarr REST web services server = | = Dolibarr REST web services server = | ||
Once module webservices REST is activated, Dolibarr become also a server of REST web services. So you can send your own REST request to relative URL | Once module webservices REST is activated, Dolibarr become also a server of REST web services. So you can send your own REST request to relative URL | ||
'''/api/index.php/xxx | '''/api/index.php/xxx''' where xxx is name of the API to call. | ||
A list of APIs on your installation can be found via the explorer. | |||
==Nginx setup== | |||
This is a simple localhost setup with a working REST API handling (tested with 9.0.1 on parabola gnu/linux). | |||
<code language=nginx> | |||
#user html; | |||
worker_processes 1; | |||
error_log /var/log/nginx/error.log; | |||
#error_log error.log notice; | |||
#error_log error.log info; | |||
#pid logs/nginx.pid; | |||
events { | |||
worker_connections 1024; | |||
} | |||
http { | |||
include mime.types; | |||
default_type application/octet-stream; | |||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |||
# '$status $body_bytes_sent "$http_referer" ' | |||
# '"$http_user_agent" "$http_x_forwarded_for"'; | |||
#access_log logs/access.log main; | |||
sendfile on; | |||
#tcp_nopush on; | |||
#keepalive_timeout 0; | |||
keepalive_timeout 65; | |||
#gzip on; | |||
server { | |||
listen 80; | |||
server_name dolibarr.localhost; # adjust to your domain | |||
root /usr/share/webapps/dolibarr/htdocs; # adjust to your path | |||
index index.php; | |||
# from https://github.com/Dolibarr/dolibarr/issues/6163#issuecomment-391265538 | |||
location ~ [^/]\.php(/|$) { | |||
fastcgi_split_path_info ^(.+?\.php)(/.*)$; | |||
if (!-f $document_root$fastcgi_script_name) { | |||
return 404; | |||
} | |||
# Mitigate https://httpoxy.org/ vulnerabilities | |||
fastcgi_param HTTP_PROXY ""; | |||
root /usr/share/webapps/dolibarr/htdocs; | |||
fastcgi_pass unix:/run/php-fpm/php-fpm.sock; | |||
fastcgi_index index.php; | |||
include fastcgi_params; | |||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |||
# Dolibarr Rest API path support | |||
fastcgi_param PATH_INFO $fastcgi_path_info; | |||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; | |||
} | |||
} | |||
} | |||
</code> | |||
= List of provided services = | = List of provided services = | ||
edits