在Centos7上源碼編譯httpd
安裝源碼包
首先在http://httpd.apache.org下載所需要的安裝包 小編在這里下載的是httpd-2.4.27.tar apr-1.6.2.tar apr-util-1.6.0.tar
首先編譯安裝apr-1.6.2.tar.gz #1 tar -zxf apr-1.6.2.tar.gz #先解壓安裝包 #2 cd apr-1.6.2/#cd到解壓的目錄下 #3 ./configure --prefix=/usr/local/apr#指定安裝的路徑 #4 make && make install
#1 然后安裝apr-util-1.6.0.tar.gz #2 cd apr-util-1.6.0/ #3 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr #4 make && make install #5 yum install pcre-devel
#1 最后安裝httpd-2.4.27.tar.bz2 #2 tar -jxf httpd-2.4.27.tar.bz2 #3 cd httpd-2.4.27/ #4 ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --sysconfdir=/etc/httpd #5 make && make install
安裝好后的配置
#1 導出二進制程序目錄至PATH環境變量中,編輯文件/etc/profile.d/NAME.sh #2 echo "export PATH=/usr/local/httpd/bin/:$PATH" > /etc/profile.d/httpd.sh #3 source /etc/profile #重讀 #4 systemctl stop firewalld.service #關閉防火墻 #5 netstat -nltp|grep 80 #6 如果發現80端口沒有處在監聽狀態 #7 cd /usr/local/httpd/conf/ #8 vim httpd.conf #9 找到#ServerName www.example.com:80 把#號去掉 #10 然后運行httpd start 就ok拉然后在瀏覽器上輸入你虛擬機的地址測試下
![]()
原創文章,作者:N27_flypig,如若轉載,請注明出處:http://www.www58058.com/85249