部署apache
部署apache
使用yum安裝
yum install -y httpd配置防火墻
centos7默認(rèn)防火墻firewall,配置防火墻開放80端口。
#配置80端口開放 firewall-cmd --zone=public --add-port=80/tcp --permanent #跟新規(guī)則 firewall-cmd --reload #查看 firewall-cmd --query-port=80/tcp出現(xiàn)Unit firewalld.service could not be found.情況,運(yùn)行以下命令安裝firewalld模塊即可
yum install firewalld systemd -ycentos7防火墻服務(wù)
#開啟 systemctl start firewalld.service #重啟 systemctl restart firewalld.service #查看 systemctl status firewalld.service #關(guān)閉 systemctl stop firewalld.service #禁用(開機(jī)禁用) systemctl disable firewalld.service #啟用(開機(jī)開啟) systemctl enable firewalld.service關(guān)閉SELinux
SELinux是Linux的一個(gè)安全子系統(tǒng),如果你不熟悉Linux的,干脆把它關(guān)了就行了。
臨時(shí)關(guān)閉
setenforce 0配置更改
主配置文件位于:/etc/httpd/conf/httpd.conf
yum安裝的話配置文件一般不用改,注意幾個(gè)點(diǎn)即可
#看看你有沒有監(jiān)聽80端口 Listen 80#這個(gè)可以選擇改(默認(rèn)就是開放的),這個(gè)為對(duì)所有ip都允許訪問(wèn)/var/www/html <Directory /var/www/html>Options FollowSymLinksAllowOverride AllAllow from allRequire all granted </Directory>啟動(dòng)
systemctl start httpd整合PHP
一樣使用yum下載
sudo yum install -y php然后重啟apache服務(wù)器即可,使用yum安裝的php好像會(huì)處理apache之間的整合,所以這里不用修改也能用。
systemctl start httpd測(cè)試
在/var/www/html目錄下弄一個(gè)index.php,然后訪問(wèn)一下試試即可。
vim /var/www/html/index.php總結(jié)
- 上一篇: 抑制性神经递质是什么意思
- 下一篇: 胎产式是指什么