詳解CentOS7安裝配置Apache HTTP Server
RPM安裝httpd
# yum -yinstall httpd //安裝httpd會自動安裝一下依賴包: apr apr-util httpd-tools mailcap # rpm -qi httpd Name : httpd Version : 2.4.6 Release : 18.el7.centos Architecture: x86_64 Install Date: Mon 11 Aug 2014 02:44:55 PMCST Group : System Environment/Daemons Size : 9793373 License : ASL 2.0 Signature : RSA/SHA256, Wed 23 Jul 2014 11:21:22 PM CST, Key ID 24c6a8a7f4a80eb5 Source RPM : httpd-2.4.6-18.el7.centos.src.rpm Build Date : Wed 23 Jul 2014 10:49:10 PM CST Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://httpd.apache.org/ Summary : Apache HTTP Server Description : The Apache HTTP Server is a powerful,efficient, and extensible web server.
修改配置文件
# cd /etc/httpd/conf # ls httpd.conf magic #cp httpd.conf httpd.conf.origin //將原有配置文件備份 # more httpd.conf //查看配置文件,我們注意到以一配置: DocumentRoot"/var/www/html" //特別是要注意這個配置 //這是Apache 2.4的一個新的默認(rèn)值,拒絕所有的請求! <Directory /> AllowOverride none Require all denied </Directory> //設(shè)置為自動啟動 # systemctl enable httpd.service ln -s'/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service' //在centos7中chkconfig httpd on 被替換成 systemctl enable httpd
配置WEB站點 (假設(shè)使用/wwwroot目錄下的文檔)
//創(chuàng)建兩個網(wǎng)站的目錄結(jié)構(gòu)及測試用頁面文件 # mkdir/wwwroot/www # echo"www.bigcloud.local" > /wwwroot/www/index.html # mkdir/wwwroot/crm # echo"crm.bigcloud.local" > /wwwroot/crm/index.html //配置虛擬機(jī)主機(jī) # cd/etc/httpd/ # mkdirvhost-conf.d # echo"Include vhost-conf.d/*.conf" >> conf/httpd.conf # vi/etc/httpd/vhost-conf.d/vhost-name.conf //添加如下內(nèi)容 <VirtualHost *:80> ServerNamewww.bigcloud.local DocumentRoot /wwwroot/www/ </VirtualHost> <Directory /wwwroot/www/> Requireall granted </Directory> <VirtualHost *:80> ServerNamecrm.bigcloud.local DocumentRoot /wwwroot/crm/ </VirtualHost> <Directory /wwwroot/crm/> Require ip192.168.188.0/24 //可以設(shè)置訪問限制 </Directory>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Linux 內(nèi)核通用鏈表學(xué)習(xí)小結(jié)
本篇文章主要介紹了Linux 內(nèi)核通用鏈表學(xué)習(xí)小結(jié),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-11-11
linux報錯INFO:task?xxxxxx:634?blocked?for?more?than?120?
文章描述了一個Linux最小系統(tǒng)運行時出現(xiàn)的“hung_task_timeout_secs”錯誤,并探討了三種解決方案:縮小文件系統(tǒng)緩存大小、修改IO調(diào)度策略和取消120秒時間限制,通過測試,發(fā)現(xiàn)縮減文件系統(tǒng)緩存大小和取消120秒時間限制都可以解決問題2025-01-01
解決Vmware虛擬機(jī)安裝centos8報錯“Section?%Packages?Does?Not?End?W
這篇文章介紹了解決Vmware虛擬機(jī)安裝centos8報錯“Section?%Packages?Does?Not?End?With?%End.?Pane?Is?Dead”的方法,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2022-05-05
虛擬機(jī)安裝centos7的坑之找不到網(wǎng)卡問題及解決
這篇文章主要介紹了虛擬機(jī)安裝centos7的坑之找不到網(wǎng)卡問題及解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10
安裝redhat 8.0紅帽系統(tǒng)的圖文教程(小白必備)
這篇文章主要介紹了安裝redhat 8.0紅帽系統(tǒng)的圖文教程(小白必備),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-12-12
Windows Apache2.4 VC9(ApacheHaus)詳細(xì)安裝配置教程
這篇文章主要介紹了Windows Apache2.4 VC9(ApacheHaus)詳細(xì)安裝配置教程,需要的朋友可以參考下2017-09-09

