Dolibarr 版本:10.0.3 - api 文档:https://wiki.dolibarr.org/index.php/Module_Web_Services_API_REST_(developer)。我在 dolibarr 文档中找不到有关 nginx 配置的任何信息。但这似乎是一个nginx配置问题。
带有位置的 nginx 配置部分:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
我测试了我发现的所有内容,但没有成功添加:
#test 1
rewrite ^/api/index.php/explorer(.*)$ /api/index.php last;
#test 2
location /api {
if ( !-e $request_filename) {
rewrite ^.* /api/index.php last;
}
}
#test 3
location ~ ^/api/(?!(index\.php))(.*) {
try_files $uri /api/index.php/$2?$query_string;
}
对于前 2 个解决方案,API api/index.php/explore 会响应,但我无权访问登录:
我应该有这个: