Table of contents
Configure the Apache service
- Switch the current user of the server to
root
the user to facilitate subsequent configuration applications.sudo su root
- Run the following command to install the Apache service.
yum install -y httpd
- Run the following commands in sequence to start the Apache service, and set the service to start automatically at boot.
systemctl start httpd
- Start the Apache service:
systemctl start httpd
- Set the Apache service to start automatically at boot:
systemctl enable httpd
- Run the following command to check the running status of the Apache service.
systemctl status httpd
configure firewall
- Check the usage of port 80
netstat -an|grep :80
-
Check whether Apache has been installed on boot
systemctl list-unit-files | grep httpd
-
View firewall status
systemctl status firewalld
-
View firewall port openness
firewall-cmd --list-ports
-
The firewall opens port 80 of centos7
firewall-cmd --zone=public --add-port=80/tcp --permanent
-
restart firewall
firewall-cmd --reload