Why API is not working?

Post Reply
User avatar
dpeca
Site Admin
Posts: 239
Joined: Fri Jun 19, 2020 9:59 am
Why API is not working?

Post by dpeca »

In myVesta, API is closed by default to all, because of better security.

You have to whitelist it for desired remote IP addresses.

How to whitelist remote IP for accessing /api/

In SSH console run:

Code: Select all

mkdir -p /usr/local/vesta/conf_web
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
local_ip=$(ip addr|grep 'inet '|grep global|head -n1|awk '{print $2}'|cut -f1 -d/)
echo "$pub_ip" > /usr/local/vesta/conf_web/allow_ip_for_api.conf
if [ "$pub_ip" != "$local_ip" ]; then echo "$local_ip" >> /usr/local/vesta/conf_web/allow_ip_for_api.conf; fi
echo "127.0.0.1" >> /usr/local/vesta/conf_web/allow_ip_for_api.conf
and add to /usr/local/vesta/conf_web/allow_ip_for_api.conf any other IP that should be able to access /api/ on that server.

You can add each IP per each line.

Tags:


Post Reply