命令查看是否已經安裝了apache服務器httpdlinux
rpm -qa | grep httpd
apache
vim
ps -ef | grep httpd
服務器
tcp
yum remove httpd
spa
安裝httpd服務3d
yum install httpd -y
code
查看是否安裝成功blog
yum list installed | grep httpd
ip
查看配置文件
啓動httpd服務
service httpd start
主機沒法訪問apache解決方法
多是Linux內置防火牆的限制,須要將tcp端口配置爲容許任何ip訪問
iptables -I INPUT -p TCP --dport 80 -j ACCEPT
這種方法是臨時生效的,須要設置/etc/selinux/config中SELINUX的值
vim /etc/selinux/config
註釋掉#SELINUX=enforcing,增長SELINUX=disabled
保存退出,並更改用戶運行級別
chkconfig --level 3 iptables off
chkconfig --level 5 iptables off
輸入ip加端口號就能訪問到apache默認頁面
輸入ip加端口號就能訪問到apache默認頁面