จะทำอย่างไรเมื่อเว็บของคุณล่ม?

เมื่อเจอเหตุการณ์ที่เว็บไซต์ของเราไม่สามารถเข้าใช้งานได้ เราจะทำอย่างไรดี? ลองมาดูวิธีการแก้ไขปัญหาเบื้องต้นจากประสบการณ์ของทีมงานเราโดยตรงกันเลยดีกว่าครับ
*** กรณีที่ตัวเครื่องใช้งานได้อย่างปกติ แต่ Service ที่เป็น Web server ไม่สามารถใช้งานได้
- เช็คดูว่าได้เปิด Port 80 (HTTP) หรือ 443 (HTTPS) บน Security Group แล้วหรือยัง เพราะถ้าไม่ได้เปิด Port นั้นๆก็จะไม่สามารถเข้าใช้งานเว็บไซต์ได้นะจ้ะ!
- ตรวจสอบ service เช่น service apache2 status ตรงนี้อาจจะแบ่งหลักๆ ได้ 2 OS คือ Ubuntu (apache2, nginx, tomcat) และ CentOS (httpd, nginx) และสามารถตรวจสอบ Service ทั้งหมดด้วยคำสั่ง :
service --status-all
สามารถตรวจสอบเพิ่มเติมได้ว่ามี Service อะไรรันอยู่บน Port อะไร ด้วยใช้คำสั่ง :
$ netstat -tapnu | grep LISTEN

***กรณีที่ Service Web Run อยู่ตามปกติ แต่ไม่สามารถเข้าใช้งานเว็ปไซต์ได้
- ให้ลองทำการ telnet จากเครื่องภายนอก เพื่อตรวจสอบก่อน โดยใช้คำสั่ง :
$ telnet 203.154.150.XXX 80

$ curl 203.154.150.XXX:80

$ curl localhost:80
$ curl 127.0.0.1:80
ซึ่งถ้าสามารถ curl แล้วมี code ตอบกลับมาที่เครื่อง host แต่ภายนอกไม่สามารถ curl หรือ telnet มาได้ ให้ตรวจสอบ Service ที่เกี่ยวข้องกับ Firewall ภายในเครื่องทั้งหมด
สำหรับ Ubuntu คือ ufw และ iptables ส่วน CentOS คือ firewalld ให้ลองทำการ stop service พวกนี้ไปก่อน แล้วลองทำการ check โดยทำการ telnet และ curl ดูอีกที
****การเข้าไปปิด Service Firewall หรือเข้าไป Config ขอให้ทำเป็นขั้นตอนสุดท้าย เพราะส่วนมากจะเกิดจากสาเหตุง่ายๆ เช่น การไม่เปิด port หรือ service ไม่ได้รัน แค่นั้นเอง****
****การใช้คำสั่งเบื้องต้น เช่น ใช้คำสั่งที่ check service เช่น telnet, curl, netstat เพื่อตรวจสอบให้แน่ใจก่อนว่า service web ทำงานอยู่ แต่ที่เข้าเวปไม่ได้อาจจะเกี่ยวกับ service อื่นๆ ครับ

ติดตามข่าวสารใหม่ๆ หรือข้อมูลน่ารู้อีกมากมายได้ที่
OpenLandscape Fanpage | https://www.facebook.com/openlandscapecloud/
OpenLandscape Twitter | https://www.twitter.com/olscloud/
OpenLandscape Cloud | https://openlandscape.cloud/
OpenLandscape Blog | http://203.150.107.90/
But telling best dissertation writing service courts that an ‘appropriate’ education means a ‘significant’ one, which in turn means an ‘appropriate’ one, hardly helps them draw buy essay a principled line.
Simple is the best but everything can change for a reason.