# Help with API on VPS

**URL:** <https://www.dolibarr.org/forum/t/help-with-api-on-vps/25240>\
**Category:** Maintaining my Dolibarr\
**Tags:** Linux\
**Created:** [April 20, 2024, 6:22pm UTC](https://www.dolibarr.org/forum/t/help-with-api-on-vps/25240 "2024-04-20T18:22:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![egils](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/e/a88e57/32.png) [@egils](https://www.dolibarr.org/forum/u/egils)\
**Post date:** [April 20, 2024, 6:22pm UTC](https://www.dolibarr.org/forum/t/help-with-api-on-vps/25240/1 "2024-04-20T18:22:05Z")

</div>

I moved my dolibarr to a linux VPS and since then the API endpoint does not work.

This is my nginx configuration:

```auto
server {
    listen 80;
    server_name [ip-adress];

    root /opt/dolibarr/htdocs;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

```

I replaced my VPS IP with [ip-adress]  
My version is 14.0.5  
Any ideas?

I this a solution?  
[Module Web Services API REST (developer) - Dolibarr ERP CRM Wiki](https://wiki.dolibarr.org/index.php?title=Module_Web_Services_API_REST_(developer)#Nginx_setup) →

```auto
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;

```

---

<div class="post-metadata">

**Author:** ![jonbendtsen](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jonbendtsen](https://www.dolibarr.org/forum/u/jonbendtsen)\
**Post date:** [April 20, 2024, 6:45pm UTC](https://www.dolibarr.org/forum/t/help-with-api-on-vps/25240/2 "2024-04-20T18:45:23Z")

</div>

@egils does it work from inside your VPS if you use something like curl to reach the API?

what is the error message if any?

try with curl from outside the VPS and post that error message too

---

<div class="post-metadata">

**Author:** ![libremaster](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/libremaster/32/8686_2.png) [@libremaster](https://www.dolibarr.org/forum/u/libremaster)\
**Post date:** [April 20, 2024, 6:54pm UTC](https://www.dolibarr.org/forum/t/help-with-api-on-vps/25240/3 "2024-04-20T18:54:52Z")

</div>

My config :

```auto
server {
  listen *:443 ssl http2;
  listen [::]:443 ssl http2 ;

  server_name xxx.com;

  ssl_certificate /etc/letsencrypt/live/xxx.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/xxx.com/privkey.pem;
  ssl_trusted_certificate /etc/letsencrypt/live/xxx.com/chain.pem;

  index index.html index.htm index.php;
  access_log /var/log/nginx/ssl-xxx.com_ssl.access.log;
  error_log /var/log/nginx/ssl-xxx.com_ssl.error.log;

  root /var/www/users/dol/xxx.com/web/;
      add_header "X-Robots-Tag" "noindex";

  location ~ \.php(/|$) {
    include /etc/nginx/fastcgi_params;
    set $path_info $fastcgi_path_info;
    add_header "X-Robots-Tag" "noindex";
    include /etc/nginx/fastcgi.conf;

    fastcgi_pass unix:/var/run/php8.2-fpm-dol.sock;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    try_files $fastcgi_script_name =404;
    fastcgi_buffer_size 32k;
    fastcgi_buffers 8 16k;
    fastcgi_busy_buffers_size 32k;
    fastcgi_intercept_errors on;
  }
}

```

---

<div class="post-metadata">

**Author:** ![egils](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/e/a88e57/32.png) [@egils](https://www.dolibarr.org/forum/u/egils)\
**Post date:** [April 22, 2024, 6:43am UTC](https://www.dolibarr.org/forum/t/help-with-api-on-vps/25240/4 "2024-04-22T06:43:06Z")

</div>

@libremaster  
I copied your location protocol, and it works like a charm now. Thank you for sharing! 🤩
