715
edits
(→安装) |
(→安装) Tag: 2017 source edit |
||
| Line 25: | Line 25: | ||
激活 '''API / Web 服务 (REST 服务器)''' 模块后,Dolibarr 将成为REST Web服务器。您可以在相应的URL上发送自己的REST请求 : '''/api/index.php/xxx''' 其中xxx是要调用的API的名称。 | 激活 '''API / Web 服务 (REST 服务器)''' 模块后,Dolibarr 将成为REST Web服务器。您可以在相应的URL上发送自己的REST请求 : '''/api/index.php/xxx''' 其中xxx是要调用的API的名称。 | ||
A list of APIs on your installation can be found via the explorer. Click on link to explorer to open the API explorer. | |||
==Apache setup== | |||
There is nothing to do. If your Dolibarr is working with Apache, the REST API should also work. APIs will be served by the same virtual web server than your application. | |||
==Nginx setup== | |||
Like Apache, if your Dolibarr is working inside a NGinx virtual host, you should have nothing to do to have your API working. APIs will be served by the same virtual web server than your application. | |||
However, NGinx default setup on a lot of distribution is often a gaz engine and you may experience troubles. If you experience such troubles, you can try to edit your NGinx config file to match the following example. This is a simple localhost setup with a working REST API handling (tested with 9.0.1 on parabola gnu/linux). | |||
<syntaxhighlight lang="nginx"> | |||
worker_processes 1; | |||
error_log /var/log/nginx/error.log; | |||
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; | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
=Liste des services fournis= | =Liste des services fournis= | ||
edits