實驗環境:CentOS7
實驗步驟:
安裝httpd服務:yum -y install httpd
關閉SELinux:setenforce 0
禁用防火牆政策:iptables -F
啟動httpd服務:systemctl start httpd
啟動程序後,在不重新開機服務的情況下,生效對配置檔案的修改(用kill -1):kill -1 PID(httpd)
[root@localhost ~]#netstat -ntlp #檢視80端口是否啟動
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2257/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1001/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 946/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2159/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 35010/sshd: root@pt
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 35946/sshd: root@pt
tcp6 0 0 :::111 :::* LISTEN 1/systemd
tcp6 0 0 :::80 :::* LISTEN 44037/httpd
tcp6 0 0 :::22 :::* LISTEN 1001/sshd
tcp6 0 0 ::1:631 :::* LISTEN 946/cupsd
tcp6 0 0 ::1:25 :::* LISTEN 2159/master
tcp6 0 0 ::1:6010 :::* LISTEN 35010/sshd: root@pt
tcp6 0 0 ::1:6011 :::* LISTEN 35946/sshd: root@pt
[root@localhost ~]#iptables -F #禁用防火牆政策
[root@localhost conf]#getenforce #關閉SELinux
Enforcing
[root@localhost conf]#setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@localhost conf]#setenforce 0
[root@localhost conf]#getenforce
Permissive