Конфигурация Dolibarr и nginx - api REST не работает
Версия Dolibarr: 10.0.3 - документация api: https://wiki.dolibarr.org/index.php/Module_Web_Services_API_REST_(developer). Я не могу найти ничего о конфигурации nginx в документации dolibarr. Но, похоже, это проблема конфигурации 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;
}
С первыми двумя решениями API api/index.php/explore отвечает, но у меня нет доступа к логину:
У меня должно быть это:
0 ответов
Это хорошо работает:https://wiki.dolibarr.org/index.php/Module_Web_Services_API_REST_(developer)#Nginx_setup
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;
}
}