Why API is not working?
Posted: Sat Jul 25, 2020 7:19 pm
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:
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.
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
You can add each IP per each line.