mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 13:01:52 -07:00
Fixing a bug that caused $pub_ip is always empty string
Putting update-firewall before getting $pub_ip is fixing this issue
This commit is contained in:
parent
6531834def
commit
5356e95d2f
1 changed files with 6 additions and 7 deletions
|
@ -1177,6 +1177,11 @@ $VESTA/bin/v-update-sys-ip
|
||||||
ip=$(ip addr|grep 'inet '|grep global|head -n1|awk '{print $2}'|cut -f1 -d/)
|
ip=$(ip addr|grep 'inet '|grep global|head -n1|awk '{print $2}'|cut -f1 -d/)
|
||||||
copy_of_ip=$ip
|
copy_of_ip=$ip
|
||||||
|
|
||||||
|
# Firewall configuration
|
||||||
|
if [ "$iptables" = 'yes' ]; then
|
||||||
|
$VESTA/bin/v-update-firewall
|
||||||
|
fi
|
||||||
|
|
||||||
# Get public ip
|
# Get public ip
|
||||||
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
|
pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
|
||||||
|
|
||||||
|
@ -1185,15 +1190,9 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
|
||||||
ip=$pub_ip
|
ip=$pub_ip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Firewall configuration
|
|
||||||
if [ "$iptables" = 'yes' ]; then
|
|
||||||
$VESTA/bin/v-update-firewall
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Configuring libapache2-mod-remoteip
|
# Configuring libapache2-mod-remoteip
|
||||||
if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
|
if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
|
||||||
# Get public ip after firewall update
|
copy_of_pub_ip=$pub_ip
|
||||||
copy_of_pub_ip=$(curl -s vestacp.com/what-is-my-ip/)
|
|
||||||
echo "<IfModule mod_remoteip.c>" > /etc/apache2/mods-available/remoteip.conf
|
echo "<IfModule mod_remoteip.c>" > /etc/apache2/mods-available/remoteip.conf
|
||||||
echo " RemoteIPHeader X-Real-IP" >> /etc/apache2/mods-available/remoteip.conf
|
echo " RemoteIPHeader X-Real-IP" >> /etc/apache2/mods-available/remoteip.conf
|
||||||
if [ "$copy_of_ip" != "127.0.0.1" ] && [ "$copy_of_pub_ip" != "127.0.0.1" ]; then
|
if [ "$copy_of_ip" != "127.0.0.1" ] && [ "$copy_of_pub_ip" != "127.0.0.1" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue