Skip to content

Commit 7d702f8

Browse files
committed
Switch from rpaf to remoteip module
1 parent e472a33 commit 7d702f8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

upd/switch_rpath.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
# Switch apache to remoteip module
3+
4+
# Checking rpaf config
5+
if [ ! -e "/etc/apache2/mods-enabled/rpaf.load" ]; then
6+
exit
7+
fi
8+
9+
# Checking remoteip module
10+
if [ ! -e "/etc/apache2/mods-available/remoteip.load" ]; then
11+
exit
12+
fi
13+
14+
# Disabling rpaf
15+
/usr/sbin/a2dismod rpaf > /dev/null 2>&1
16+
rm -f /etc/apache2/mods-enabled/rpaf.conf
17+
18+
# Enabling remoteip
19+
/usr/sbin/a2enmod remoteip > /dev/null 2>&1
20+
21+
# Creating configuration
22+
conf="/etc/apache2/mods-enabled/remoteip.conf"
23+
echo "<IfModule remoteip_module>" > $conf
24+
echo " RemoteIPHeader X-Real-IP" >> $conf
25+
for ip in $(ls /usr/local/vesta/data/ips); do
26+
echo " RemoteIPInternalProxy $ip" >> $conf
27+
done
28+
echo "</IfModule>" >> $conf
29+
30+
# Restarting apache
31+
/usr/sbin/apachectl restart > /dev/null 2>&1
32+
33+
# EOF
34+
exit

0 commit comments

Comments
 (0)