詳解CentOS7安裝配置Apache HTTP Server
更新時間:2017年01月17日 09:14:30 作者:李豪leaus
本篇文章主要介紹了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的一個新的默認值,拒絕所有的請求! <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 //配置虛擬機主機 # 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 PXE高效批量網(wǎng)絡(luò)裝機過程
PXE(預(yù)啟動執(zhí)行環(huán)境)是一種網(wǎng)絡(luò)引導(dǎo)技術(shù),允許從遠程服務(wù)器通過網(wǎng)絡(luò)下載引導(dǎo)鏡像來安裝操作系統(tǒng),本文介紹了PXE的優(yōu)點如規(guī)模化、自動化和遠程實現(xiàn),以及搭建PXE服務(wù)器的基本步驟,包括安裝和配置TFTP、DHCP服務(wù)2024-09-09centOS7.4 安裝 mysql 5.7.26的教程詳解
CentOS中默認安裝有MariaDB,這個是MySQL的分支,但為了需要,還是要在系統(tǒng)中安裝MySQL,而且安裝完成之后可以直接覆蓋掉MariaDB。這篇文章主要介紹了centOS7.4 安裝 mysql 5.7.26,需要的朋友可以參考下2019-06-06使用 libevent 和 libev 提高網(wǎng)絡(luò)應(yīng)用性能的方法
構(gòu)建現(xiàn)代的服務(wù)器應(yīng)用程序需要以某種方法同時接收數(shù)百、數(shù)千甚至數(shù)萬個事件,無論它們是內(nèi)部請求還是網(wǎng)絡(luò)連接,都要有效地處理它們的操作2011-05-05在 Ubuntu Linux 上安裝 Oracle Java 14的方法
最近,Oracle 宣布 Java 14(或 Oracle JDK 14)公開可用。如果你想進行最新的實驗或者開發(fā)的話,那么你可以試試在 Linux 系統(tǒng)上安裝 Java 14,感興趣的朋友可以參考下本文2020-04-04Linux之多線程以及多線程并發(fā)訪問同一塊內(nèi)存的處理問題
這篇文章主要介紹了Linux之多線程以及多線程并發(fā)訪問同一塊內(nèi)存的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-03-03