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