TotHost on Tết holiday mode from Feb 14 – Feb 22, support may be a bit late. Thanks for your understanding!

Guide to Opening Port 80 and 443 in Firewall Print

  • error, setup
  • 315

[Tiếng Việt bên dưới]

With a firewall, you can open ports temporarily or permanently. Temporary rules are deleted upon system reboot. If you wish to open ports temporarily, you can use the following commands (the port will be closed if the system is rebooted):

firewall-cmd --zone=public --add-port=80/tcp

firewall-cmd --zone=public --add-port=443/tcp

To open ports permanently, use these commands:

firewall-cmd --permanent --zone=public --add-port=80/tcp

firewall-cmd --permanent --zone=public --add-port=443/tcp

The "--permanent" option ensures rules persist even after system restarts. Next, you'll need to reload FirewallD for the changes to take effect. To reload FirewallD, use this command:

firewall-cmd --reload

Viewing Rules

After adding rules, you can verify their successful addition by running the following command:

firewall-cmd --permanent --zone=public --list-ports

Removing Rules

If you want to remove added rules, you can use the following commands:

firewall-cmd --permanent --zone=public --remove-port=80/tcp

firewall-cmd --permanent --zone=public --remove-port=443/tcp

Next, execute the following command to apply the changes:

firewall-cmd --reload Conclusion

 

[Tiếng Việt] Hướng dẫn mở Port 80 và 443 trong Firewall

Sá»­ dụng tưá»ng lá»­a, bạn có thể mở port tạm thá»i hoặc vÄ©nh viá»…n. Các rule tạm thá»i sẽ bị xóa sau khi khởi động lại hệ thống.

  • Nếu muốn mở bá»n tạm thá»i các bạn dùng lệnh sau (Port sẽ bị đóng nếu khởi động lại hệ thống):

firewall-cmd --zone=public --add-port=80/tcp

firewall-cmd --zone=public --add-port=443/tcp

  • Äể mở port vÄ©nh viến các bạn dùng lệnh sau:

firewall-cmd --permanent --zone=public --add-port=80/tcp

firewall-cmd --permanent --zone=public --add-port=443/tcp

Tùy chá»n –permanent đảm bảo các rule vẫn được áp dụng kể cả khi khởi động lại hệ thống. Tiếp theo, các bạn sẽ cần phải reload lại FirewallD để thay đổi có hiệu lá»±c. Äể reload FirewallD các bạn sá»­ dụng lệnh sau:

firewall-cmd --reload

Mở Port 80 và 443 trong FirewallD

Xem các rule

Sau khi thêm các rule, bạn có thể xác minh xem rule đã được thêm thành công hay chưa bằng cách chạy lệnh sau.

firewall-cmd --permanent --zone=public --list-ports

Xóa rule

Nếu bạn muốn xoá rule đã thêm các bạn có thể sử dụng lệnh như sau:

firewall-cmd --permanent --zone=public --remove-port=80/tcp

firewall-cmd --permanent --zone=public --remove-port=443/tcp

Tiếp theo, chạy lệnh sau để áp dụng các thay đổi:

firewall-cmd --reload

 


Was this answer helpful?

« Back