@@ -20,7 +20,7 @@ vestacp="http://$CHOST/$VERSION/$release"
2020
2121if [ " $release " -eq 8 ]; then
2222 software=" nginx apache2 apache2-utils apache2.2-common
23- apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
23+ apache2-suexec-custom libapache2-mod-ruid2
2424 libapache2-mod-fcgid libapache2-mod-php5 php5 php5-common php5-cgi
2525 php5-mysql php5-curl php5-fpm php5-pgsql awstats webalizer vsftpd
2626 proftpd-basic bind9 exim4 exim4-daemon-heavy clamav-daemon
@@ -32,7 +32,7 @@ if [ "$release" -eq 8 ]; then
3232 bsdmainutils cron vesta vesta-nginx vesta-php expect"
3333else
3434 software=" nginx apache2 apache2-utils apache2.2-common
35- apache2-suexec-custom libapache2-mod-ruid2 libapache2-mod-rpaf
35+ apache2-suexec-custom libapache2-mod-ruid2
3636 libapache2-mod-fcgid libapache2-mod-php5 php5 php5-common php5-cgi
3737 php5-mysql php5-curl php5-fpm php5-pgsql awstats webalizer vsftpd
3838 proftpd-basic proftpd-mod-vroot bind9 exim4 exim4-daemon-heavy
@@ -527,7 +527,6 @@ if [ "$apache" = 'no' ]; then
527527 software=$( echo " $software " | sed -e " s/apache2-suexec-custom//" )
528528 software=$( echo " $software " | sed -e " s/apache2.2-common//" )
529529 software=$( echo " $software " | sed -e " s/libapache2-mod-ruid2//" )
530- software=$( echo " $software " | sed -e " s/libapache2-mod-rpaf//" )
531530 software=$( echo " $software " | sed -e " s/libapache2-mod-fcgid//" )
532531 software=$( echo " $software " | sed -e " s/libapache2-mod-php5//" )
533532fi
@@ -830,6 +829,7 @@ if [ "$apache" = 'yes' ]; then
830829 a2enmod ssl
831830 a2enmod actions
832831 a2enmod ruid2
832+ a2enmod headers
833833 mkdir -p /etc/apache2/conf.d
834834 echo > /etc/apache2/conf.d/vesta.conf
835835 echo " # Powered by vesta" > /etc/apache2/sites-available/default
@@ -1164,9 +1164,9 @@ $VESTA/bin/v-change-user-language admin $lang
11641164
11651165# RoundCube permissions fix
11661166if [ " $exim " = ' yes' ] && [ " $mysql " = ' yes' ]; then
1167- if [ ! -d " /var/log/roundcube" ]; then
1168- mkdir /var/log/roundcube
1169- fi
1167+ if [ ! -d " /var/log/roundcube" ]; then
1168+ mkdir /var/log/roundcube
1169+ fi
11701170 chown admin:admin /var/log/roundcube
11711171fi
11721172
@@ -1175,17 +1175,39 @@ $VESTA/bin/v-update-sys-ip
11751175
11761176# Get main ip
11771177ip=$( ip addr| grep ' inet ' | grep global| head -n1| awk ' {print $2}' | cut -f1 -d/)
1178+ copy_of_ip=$ip
1179+
1180+ # Firewall configuration
1181+ if [ " $iptables " = ' yes' ]; then
1182+ $VESTA /bin/v-update-firewall
1183+ fi
11781184
11791185# Get public ip
11801186pub_ip=$( curl -s vestacp.com/what-is-my-ip/)
1187+
11811188if [ ! -z " $pub_ip " ] && [ " $pub_ip " != " $ip " ]; then
11821189 $VESTA /bin/v-change-sys-ip-nat $ip $pub_ip
11831190 ip=$pub_ip
11841191fi
11851192
1186- # Firewall configuration
1187- if [ " $iptables " = ' yes' ]; then
1188- $VESTA /bin/v-update-firewall
1193+ # Configuring libapache2-mod-remoteip
1194+ if [ " $apache " = ' yes' ] && [ " $nginx " = ' yes' ] ; then
1195+ copy_of_pub_ip=$pub_ip
1196+ echo " <IfModule mod_remoteip.c>" > /etc/apache2/mods-available/remoteip.conf
1197+ echo " RemoteIPHeader X-Real-IP" >> /etc/apache2/mods-available/remoteip.conf
1198+ if [ " $copy_of_ip " != " 127.0.0.1" ] && [ " $copy_of_pub_ip " != " 127.0.0.1" ]; then
1199+ echo " RemoteIPInternalProxy 127.0.0.1" >> /etc/apache2/mods-available/remoteip.conf
1200+ fi
1201+ if [ ! -z " $copy_of_ip " ] && [ " $copy_of_ip " != " $copy_of_pub_ip " ]; then
1202+ echo " RemoteIPInternalProxy $copy_of_ip " >> /etc/apache2/mods-available/remoteip.conf
1203+ fi
1204+ if [ ! -z " $copy_of_pub_ip " ]; then
1205+ echo " RemoteIPInternalProxy $copy_of_pub_ip " >> /etc/apache2/mods-available/remoteip.conf
1206+ fi
1207+ echo " </IfModule>" >> /etc/apache2/mods-available/remoteip.conf
1208+ sed -i " s/LogFormat \" %h/LogFormat \" %a/g" /etc/apache2/apache2.conf
1209+ a2enmod remoteip
1210+ service apache2 restart
11891211fi
11901212
11911213# Configuring mysql host
0 commit comments