본문 바로가기
DEVELOPMENT/SERVER(centos7)

centos8 http&https open port firewalld

by Z@__ 2021. 7. 28.
반응형

 

기존에 centos7 방화벽 관련 설정을 이곳에 포스팅해두었다.

 

centos 방화벽 설정 port 80 오픈

80번 포트를 이용하여 웹서비스를 하기 위해서는 80번 포트를 열어줘야 합니다. 80번 포트를 열어주는 방법은 # 80번 포트를 여는 방법 fiewall-cmd --zone=public --permanent --add-port=80/tcp # 방화벽 적용 f..

zel0rd.tistory.com

 

 

현재 사용중인 서버는 centos8 이기 때문에 바뀐 방화벽 설정 명령을 정리해보려고 한다.

 

Step1.Check the status of your firewall.

# firewall-cmd --state
running

 

Step2. Retrieve your currently active zones. Take a note of the zone within which you wish to open ports 80 and 443:

# firewall-cmd --get-active-zones
libvirt
  interfaces: virbr0 
public
  interfaces: enp0s3

 

Step3. Open port 80 and port 443 port.

# firewall-cmd --zone=public --add-service=http
# firewall-cmd --zone=public --add-service=https
728x90

Step4. Open port 80 and port 443 port permanently. Execute the below commands to open both ports permanently, hence, make the settings persistent after reboot:

# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload

 

Step5. Check for open ports/services. The services with permanently open ports are listed on line starting with services::

# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3
  sources: 
  services: cockpit dhcpv6-client http https ssh
  ports: 
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules:

 

Step6. In case you need to close the previously open HTTP port 80 and HTTPS port 443 execute:

# firewall-cmd --zone=public --permanent --remove-service=http
# firewall-cmd --zone=public --permanent --remove-service=https
# firewall-cmd --reload

 

 

 

반응형

댓글