Pages - Menu

วันพุธที่ 1 สิงหาคม พ.ศ. 2561

แก้ปัญหา ติดตั้ง Vesta Control Panel แล้วใช้ปลั๊กอิน WP Cerber Security ใน Wordpress แล้วขึ้น IP ของ server ตัวเอง



วันก่อน ผมได้ติดตั้ง Vestacp เสร็จ หลังจากได้ลองเล่นไปสักพัก เกิดปัญหาอยู่ 1 อย่างคือ
ปลั๊กอินมองไม่เห็น IP client ซึ้งผมได้ลงปลั๊กอิน WP Cerber Security ของ Wordpress เพื่อเอาไว้เพิ่มความปลอดภัยแต่ไม่รู้ว่าเกิดบัคหรืออะไรนะ ทำให้ปลั๊กอินตัวนี้มองเห็น IP เป็น IP เครื่องเซิร์ฟเวอร์ตัวเองอย่างเดียว อาจจะเป็นปัญหา ที่ apache ทำให้มันบล๊อกเว็บตัวเองตลอดเวลาทำให้ login เข้าระบบไม่ได้


วิธีแก้ไขให้รันคำสั่งใน Command Line


wget https://raw.githubusercontent.com/serghey-rodin/vesta/master/upd/switch_rpath.sh
chmod +x switch_rpath.sh

./switch_rpath.sh

Code จาก switch_rpath.sh

#!/bin/bash
# Switch apache to remoteip module

# Checking rpaf config
if [ ! -e "/etc/apache2/mods-enabled/rpaf.load" ]; then
    exit
fi

# Checking remoteip module
if [ ! -e "/etc/apache2/mods-available/remoteip.load" ]; then
    exit
fi

if [ -f "/etc/apache2/mods-enabled/remoteip.load" ]; then
    echo "RemoteIP is already activated"
    exit
fi

# Disabling rpaf
/usr/sbin/a2dismod rpaf > /dev/null 2>&1
rm -f /etc/apache2/mods-enabled/rpaf.conf

# Enabling remoteip
/usr/sbin/a2enmod remoteip > /dev/null 2>&1

# Creating configuration
conf="/etc/apache2/mods-enabled/remoteip.conf"
echo "<IfModule remoteip_module>" > $conf
echo "    RemoteIPHeader X-Real-IP" >> $conf
for ip in $(ls /usr/local/vesta/data/ips); do
    echo "    RemoteIPInternalProxy $ip" >> $conf
done
echo "</IfModule>" >> $conf

sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf

# Restarting apache
/usr/sbin/apachectl restart > /dev/null 2>&1

# EOF
exit

อ้างอิงจาก https://forum.vestacp.com/viewtopic.php?t=13817#p56361



ไม่มีความคิดเห็น:

แสดงความคิดเห็น