CentOS下使用yum安裝Apache極為方便,只需要在終端鍵入以下命令即可
1.安裝Apache
yum install httpd
2.設(shè)置服務(wù)器開機(jī)自動(dòng)啟動(dòng)Apache
systemctl enable httpd.service
若要驗(yàn)證是否自動(dòng)啟動(dòng)可在重啟服務(wù)器后在終端鍵入以下命令來檢測(cè)Apache是否已經(jīng)啟動(dòng)
systemctl is-enabled httpd.service
如果看到了enable
這樣的響應(yīng)组题,則表示Apache已經(jīng)啟動(dòng)成功
3.手動(dòng)啟動(dòng)Apache
systemctl start httpd.service 在瀏覽器中輸入IP地址即可驗(yàn)證是否啟動(dòng)成功
4.手動(dòng)重啟Apache
systemctl restart httpd.service
5.手動(dòng)停止Apache
systemctl stop httpd.service
6.安裝目錄介紹
- Apache默認(rèn)將網(wǎng)站的根目錄指向/var/www/html
- 默認(rèn)的主配置文件/etc/httpd/conf/httpd.conf
- 配置存儲(chǔ)在的/etc/httpd/conf.d/目錄