CentOS 7 編譯安裝httpd-2.4.17

來源:互聯網
上載者:User
環境說明

VMware 12 中 CentOS 7 x64 4cpu 2G記憶體
環境中已經安裝了《CentOS 7 編譯安裝 MySQL-5.7.9》《CentOS 7 編譯安裝PHP7》 配置防火牆和開放連接埠

參考CentOS 7 編譯安裝 MySQL-5.7.9》中的 “配置防火牆和開放連接埠” 編譯安裝httpd所需依賴

下載
apr-1.5.2.tar.gz
apr-util-1.5.4.tar.gz
httpd-2.4.17.tar.gz
pcre-8.38.tar.gz
上傳到/root/目錄

######編譯安裝apr-1.5.2.tar.gz[root@localhost ~]# tar zxf apr-1.5.2.tar.gz && cd apr-1.5.2[root@localhost apr-1.5.2]# yum install gcc libtools -y[root@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apr[root@localhost apr-1.5.2]# make && make install[root@localhost apr-1.5.2]# cd .. && rm -rf ../apr-1.5.2*######編譯安裝apr-util-1.5.4.tar.gz[root@localhost ~]# tar zxf apr-util-1.5.4.tar.gz && cd apr-util-1.5.4[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/[root@localhost apr-util-1.5.4]# make && make install[root@localhost apr-util-1.5.4]# cd .. && rm -rf apr-util-1.5.4*######編譯安裝pcre-8.38.tar.gz[root@localhost ~]# tar zxf pcre-8.38.tar.gz && cd pcre-8.38[root@localhost pcre-8.38]# ./configure --prefix=/usr/local/pcre[root@localhost pcre-8.38]# make && make install[root@localhost pcre-8.38]# cd .. && rm -rf pcre-8.38*
編譯安裝httpd-2.4.17
[root@localhost ~]# tar zxf httpd-2.4.17.tar.gz && cd httpd-2.4.17[root@localhost httpd-2.4.17]# ./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre[root@localhost httpd-2.4.17]# make && make install[root@localhost httpd-2.4.17]# cd .. && rm -rf httpd-2.4.17*
配置Apache

設定Apache開機啟動,添加Apache到Linux服務

[root@localhost init.d]# vi /usr/local/apache/conf/httpd.conf1.搜尋ServerName www.example.com:80 去掉前面的注釋2.修改DocumentRoot到/home/htdocs,以及這一行下面的一句中的<Directory到/home/htdocs這個是www的根目錄設定[root@localhost apache]# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd[root@localhost init.d]# vi httpd 在第一行下添加如下兩行文字# Comments to support chkconfig on RedHat Linux# chkconfig: 2345 90 90# description:http server註冊該服務 [root@localhost init.d]# chkconfig --add httpd  #所有開機模式下自啟動[root@localhost init.d]# chkconfig httpd on  #345開機模式下自啟動
運行Apache
[root@localhost init.d]# service httpd start######查看運行狀態[root@localhost init.d]# ps -aux | grep httpd在主機瀏覽器輸入linux的ip出現It works!
參考網址

http://linux.it.net.cn/CentOS/server/webserver/2015/0320/14007.html

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.