Apache系列:Centos7.2下安裝與配置apache

Centos7.2下安裝與配置apache(一)

 

配置機:騰訊雲服務器,centos7.2php

1、安裝Apache服務(Apache軟件安裝包叫httpd)

yum install httpd -y

 

2、開啓Apache服務

systemctl start httpd

  

3、設置開機自啓Apache服務

systemctl enable httpd

 

 

4、cd var/www/html(apache網頁的存放路徑,默認下面是沒有網頁的)

 

5、vi index.html

 

 6、訪問網頁(訪問服務器的話,訪問公有ip)

 

 

 

相關配置

配置目錄及相關配置文件:html

服務目錄	/etc/httpd
主配置文件	/etc/httpd/conf/httpd.conf
網站數據目錄	/var/www/html
訪問日誌	/var/log/httpd/access_log
錯誤日誌	/var/log/httpd/error_log

  

【httpd安裝後各文件的內容及存放位置】

服務腳本:/etc/rc.d/init.d/httpd

運行目錄:/etc/httpd

配置文件:/etc/httpd/conf/

            主配置文件:httpd.conf

            擴展配置文件:/etc/httpd/conf.d/*.conf

socket:

        http: 80/tcp,

        https: 443/tcp

網頁文件目錄(DocumentRoot):

靜態頁面:/var/www/html

動態頁面(CGI): /var/www/cgi-bin/

默認主頁面:index.html  index.php

  

 

 

常見主配置文件(/etc/httpd/conf/httpd.conf)配置參數:python

ServerRoot	服務目錄
ServerAdmin	管理員郵箱
User	運行服務的用戶
Group	運行服務的用戶組
ServerName	網站服務器的域名
DocumentRoot	網站數據目錄
Listen	監聽的IP地址與端口號
DirectoryIndex	默認的索引頁頁面
ErrorLog	錯誤日誌文件
CustomLog	訪問日誌文件
Timeout	網頁超時時間,默認爲300秒.
Include	須要加載的其餘文件
相關文章
相關標籤/搜索