-
Notifications
You must be signed in to change notification settings - Fork 0
/
installmodrpaf
executable file
·43 lines (39 loc) · 1.22 KB
/
installmodrpaf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Nginx Admin Installer
# Website: www.nginxcp.com
#
# Copyright (C) NGINXCP.COM.
#
cd /usr/local/src
wget -c http://nginxcp.com/latest/nginxadmin.tar
tar -xf nginxadmin.tar
cd /usr/local/src/publicnginx/mod_rpaf-0.6
#cd mod_rpaf-0.6/
/usr/local/apache/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
/usr/local/cpanel/bin/apache_conf_distiller --update
/scripts/rebuildhttpdconf
if grep "rpaf.conf" /usr/local/apache/conf/httpd.conf ; then
/scripts/rebuildippool > /dev/null 2>&1
LIST=$(/scripts/ipusage | awk '{print $1}'|while read ip; do echo -ne "${ip} "; done)
cat > /usr/local/apache/conf/includes/rpaf.conf << EOF
LoadModule rpaf_module modules/mod_rpaf-2.0.so
#Mod_rpaf settings
RPAFenable On
RPAFproxy_ips 127.0.0.1 $LIST
RPAFsethostname On
RPAFheader X-Real-IP
EOF
else
/scripts/rebuildippool
LIST=$(/scripts/ipusage | awk '{print $1}'|while read ip; do echo -ne "${ip} "; done)
cat > /usr/local/apache/conf/includes/rpaf.conf << EOF
LoadModule rpaf_module modules/mod_rpaf-2.0.so
#Mod_rpaf settings
RPAFenable On
RPAFproxy_ips 127.0.0.1 $LIST
RPAFsethostname On
RPAFheader X-Real-IP
EOF
echo "Include \"/usr/local/apache/conf/includes/rpaf.conf\"" >> /usr/local/apache/conf/httpd.conf
fi
/etc/init.d/httpd restart