在centos下安裝apache的方法是:1、執(zhí)行【yum install httpd】命令安裝httpd;2、打開配置文件,將【AllowOverride None】更改為【AllowOverride All】;3、重啟服務(wù)器。
(推薦教程:apache從入門到精通)
具體方法如下:
1、安裝httpd
yum install httpd
安裝httpd時(shí)會(huì)自動(dòng)安裝以下依賴包:
選擇y及安裝已下載好的安裝包。
2、配置
打開配置文件,把里面的 AllowOverride None 全部修改為 AllowOverride All
vi httpd.conf
順便在 DirectoryIndex index.html 后面加上 index.htm index.php index.shtml
:wq 保存退出
3、重啟服務(wù)器
service httpd restart
systemctl start httpd.service #啟動(dòng)apache systemctl stop httpd.service #停止apache systemctl restart httpd.service #重啟apache systemctl enable httpd.service #設(shè)置apache開機(jī)啟動(dòng)
4測(cè)試
在瀏覽器中輸入相應(yīng)網(wǎng)址,出現(xiàn)如下界面則表示配置成功了。