ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

Server ล่มจากการ Upgrade Apache from ver 2.2 to 2.4

by Little Bear @10 มี.ค. 60 10:54 ( IP : 49...17 ) | Tags : Server Status

วันนี้อ่านข่าว ช่องโหว่ใน Apache Struts 2 เปิดทางรันโค้ดจากระยะไกล มีการโจมตีแล้ว แล้วลองมาเช็ค Apache บน production host พบว่ายังเป็น version 2.2 อยู่ ก็เลยลอง upgrade

เริ่มแรกด้วยการตรวจสอบรุ่นของ Apache ก่อน link

On Debian and Mac OS:

apachectl -v

On Red Hat and Amazon's EC2 Linux use:

httpd -v

On other verisons of Linux try:

apache2 -v

You can use two different flags:

-v # gives you the version number
-V # gives you the compile settings including version number.

If you want to run the command with the full directory like user3786265 did but don't know where your apache is located, use the whereis command:

whereis httpd

ที่ server ใช้ Directadmin ก็ใช้ DirectAdmin build

cd /usr/local/DirectAdmin/custombuild<br />
./build set apache_ver 2.4
./build update
./build clean
./build apache n
./build php n
service httpd restart

ผลปรากฏว่า start Apache ไม่ได้ ล่มทั้ง server เนื่องจากใช้ suPHP อยู่ด้วย

รีบหาข้อมูลโดยเร็ว ทำอย่างไรดี โทรศัพท์เริ่มกริ๊งกร๊างเข้ามาแล้ว......

ที่แรก คือ Updating Apache to the latest version

ที่ต่อมา คือ Invalid command 'suPHP_Engine'

ที่สำคัญคือ build suphp และ rewrite_confs

cd /usr/local/directadmin/custombuild
./build update
./build clean
./build php y
./build suphp y
./build rewrite_confs

เหตุที่เกิดปัญหา เนื่องจาก ไม่ได้ build suphp ของ Apache 2.4 ทำให้ start Apache ไม่ได้ และเมื่อ build suphp เสร็จแล้ว จะต้องสร้าง config ใหม่ด้วย build rewrite_confs

รอดตามไปอีกครั้งหนึ่ง ชีวิตนี้มีลุ้นทุกครั้งที่ต้องอัพเกรด server

Relate topics