Iptable สำหรับการเปิด Port 443 เพื่อใช้งาน https เข้าเว็บด้วย SSL

แชร์ความรู้ Linux Ubuntu Web Server บทความ การ config server Linux FreeBSD Apache
การติดตั้ง XAMPP Mysql PHP ใครต้องการแชร์ความรู้เรื่องต่างๆ เหล่านี้ให้ ท่านหรืออื่น โพสที่หมวดนี้ได้

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41129
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Iptable สำหรับการเปิด Port 443 เพื่อใช้งาน https เข้าเว็บด้วย SSL

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

แก้ไขไฟล์ กฏของ iptable

โค้ด: เลือกทั้งหมด

nano /etc/sysconfig/iptables
เพิ่ม

โค้ด: เลือกทั้งหมด

-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
....
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
หรือ จะเพิ่มด้วย command

โค้ด: เลือกทั้งหมด

iptables -A INPUT -p tcp --dport 443 -j ACCEPT
*** วิธีใช้ ถ้ามีคำสั่งเก่าผิดอยู่ จะทำให้ใช้งานคำสั่งใหม่ที่เพิ่มเข้าไปในกฏไม่ได้

Save ด้วยคำสั่ง

โค้ด: เลือกทั้งหมด

service iptables save
แล้วทดลองรัน คำสั่งเช็ค

โค้ด: เลือกทั้งหมด

 sudo iptables -L
ผลทีไ่ด้
ควรจะมีประมาณนี้

โค้ด: เลือกทั้งหมด

sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:mysql
ACCEPT     udp  --  anywhere             anywhere            udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:EtherNet/IP-1
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:https
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:EtherNet/IP-1
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:mysql

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41129
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: Iptable สำหรับการเปิด Port 443 เพื่อใช้งาน https เข้าเว็บด้วย SSL

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ถ้าต้องการล้างการ การกำหนดกฏทั้งหมด

โค้ด: เลือกทั้งหมด

# Clear input chain
sudo iptables -F INPUT
# Flush the whole iptables
sudo iptables -F
*** คำสั่งนี้ ถ้าไม่ต้องการ เคลียร์ค่าจริงๆ ห้ามรันนะ ต้อง config ใหม่กันนะหมดนะจ๊ะ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 33