CentOS 7 編譯安裝 Apache

既然裝好了memcached 沒有apache + php 怎麼玩?
動手來裝apache吧!
當然也要用最新的!官網  apache 2.4.10 (released 2014-07-21)

下載 apache 解壓縮

#cd /tmp
#wget http://apache.stu.edu.tw//httpd/httpd-2.4.10.tar.gz
#tar -zxvf httpd-2.4.10.tar.gz
#cd httpd-2.4.10
#CFLAGS="-O3" ./configure \
--prefix=/opt/httpd \
--enable-lib64 \
--enable-proxy \
--enable-ssl \
--enable-deflate \
--with-included-apr
然後回去剛剛指定的目錄啟動他
#cd /opt/httpd/bin
#./apachectl start
順便看一下是不是真的有起來
#netstat -napto

本機 links http://localhost/ 可以,但是為什麼外面連不到?

CentOS 7 關閉預設防火牆

沒有APR?

configure: error: APR not found.  Please read the documentation. 
點這裡

沒有zlib?

checking for zlib location... not found
checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
就裝zlib-devel XD
yum
#yum install zlib-devel
apt-get
#apt-get install zlib1g-dev

OpenSSL版本太老舊?

configure: WARNING: OpenSSL version is too old
no
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
解決
yum
yum install openssl-devel
apt-get
apt-get install libssl-dev

沒有pcre?

下載編譯他安裝!官網
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz
#tar -zxvf pcre-8.34.tar.gz
#cd pcre-8.34
#./configure
#make
#make install

沒有設定ServerName?

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
就是沒去改設定檔拉!
#vi opt/httpd/conf/httpd.conf
把ServerName前面的註解拿掉,然後填上127.0.0.1

檢查errer_log 發現 mod_slotmem_shm 有錯!

Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??
先確認 mod_slotmem_shm.so 存不存在
#cd /opt/httpd/modules
#ll | grep shm*
-rwxr-xr-x. 1 root root  22664 Dec  2 01:22 mod_slotmem_shm.so
-rwxr-xr-x. 1 root root  26084 Dec  2 01:22 mod_socache_shmcb.so
然後去 httpd.conf 找
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
註解拿掉改成
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

檢查errer_log 發現 mod_lbmethod_heartbeat 有錯!

去 httpd.conf 找
LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
把他註解掉!

留言