配置機:騰訊雲服務器,centos7.2php
yum install httpd -y
systemctl start httpd
systemctl enable httpd
配置目錄及相關配置文件: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 須要加載的其餘文件