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 use docker compose to build fastDFS file server

The previous article introduced a detailed exampl...

How to install Graphviz and get started tutorial under Windows

Download and installConfigure environment variabl...

How to delete all contents in a directory using Ansible

Students who use Ansible know that Ansible only s...

A brief discussion on value transfer between Vue components (including Vuex)

Table of contents From father to son: Son to Fath...

MySQL optimization: how to write high-quality SQL statements

Preface There are a lot of information and method...

WeChat applet learning notes: page configuration and routing

I have been studying and reviewing the developmen...

webpack -v error solution

background I want to check the webpack version, b...

Interaction in web design: A brief discussion on paging issues

Function: Jump to the previous page or the next p...

Detailed explanation of ActiveMQ deployment method in Linux environment

This article describes the deployment method of A...

Combining XML and CSS styles

student.xml <?xml version="1.0" enco...

How to create your own Docker image and upload it to Dockerhub

1. First register your own dockerhub account, reg...

Solution to the problem that the mysql8.0.11 client cannot log in

This article shares with you the solution to the ...

TABLE tags (TAGS) detailed introduction

Basic syntax of the table <table>...</tab...

Detailed explanation of two ways to dynamically change CSS styles in react

The first method: dynamically add a class to show...