How to configure Linux firewall and open ports 80 and 3306

How to configure Linux firewall and open ports 80 and 3306

Port 80 is also configured. First enter the firewall configuration file

shell># vim /etc/sysconfig/iptables

Add the following two rules:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Special note: Many netizens add these two rules to the last line of the firewall configuration, causing the firewall to fail to start

The correct rule should be added below the default port 22 rule.

The added firewall configuration files are as follows:

Restart the firewall, done!

shell>#service iptables restart

The above are all the relevant knowledge points introduced this time. I hope it can help everyone.

You may also be interested in:
  • Linux firewall status check method example
  • A brief analysis of Linux to check the firewall status and the status of the ports open to the outside world
  • How to modify firewall configuration in Linux system
  • How to use firewall iptables strategy to forward ports on Linux servers
  • How to check if the firewall is turned off in Linux

<<:  JS implements a detailed plan for the smooth version of the progress bar

>>:  Usage and scenario analysis of npx command in Node.js

Recommend

How to support full Unicode in MySQL/MariaDB

Table of contents Introduction to utf8mb4 UTF8 by...

Manually install mysql5.7.10 on Ubuntu

This tutorial shares the process of manually inst...

Detailed explanation of React component communication

Table of contents Component Communication Introdu...

Analysis of MySQL user management operation examples

This article describes the MySQL user management ...

Solution to the automatic termination of docker run container

Today I encountered a problem when I used Dockerf...

Vue.js uses Element-ui to implement the navigation menu

This article shares the specific code for impleme...

Implementation of Nginx domain name forwarding

Introduction to Nginx Nginx ("engine x"...

Detailed explanation of dynamically generated tables using javascript

*Create a page: two input boxes and a button *Cod...

About the "occupational disease" of designers

I always feel that designers are the most sensiti...

Detailed explanation of EXT series file system formats in Linux

Linux File System Common hard disks are shown in ...

Common properties of frameset (dividing frames and windows)

A frame is a web page screen divided into several ...