CentOS Quickly Deploy Apache Service - Configure Firewall

Table of contents

Configure the Apache service

configure firewall


Configure the Apache service

  1. Switch the current user of the server to rootthe user to facilitate subsequent configuration applications.
    sudo su root
  2. Run the following command to install the Apache service.
    yum install -y httpd
  3. Run the following commands in sequence to start the Apache service, and set the service to start automatically at boot.
    systemctl start httpd
  4. Start the Apache service:
    systemctl start httpd
  5. Set the Apache service to start automatically at boot:
    systemctl enable httpd
  6. Run the following command to check the running status of the Apache service.
    systemctl status httpd

configure firewall

  1. Check the usage of port 80
    netstat -an|grep :80
  2. Check whether Apache has been installed on boot

    systemctl list-unit-files | grep httpd
  3. View firewall status

    systemctl status firewalld
  4. View firewall port openness

    firewall-cmd --list-ports
  5. The firewall opens port 80 of centos7

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

    firewall-cmd --reload

Guess you like

Origin blog.csdn.net/Stupid__Angel/article/details/130229784