1 下载Apache包;
安装目录在usr/local/
cd /usr/local/
wget http://www.apache.org/dist/httpd/httpd-2.4.18.tar.gz.md5
tar zxvf httpd-2.4.18.tar.gz
./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl
报错:error: APR not found
2 下载APR
cd /usr/local/
wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz
tar zxvf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make
make install
再次尝试
./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/
configure: error: APR-util not found
3 下载 APR-UTIL
cd /usr/local/
wget http://www.apache.org/dist/apr/apr-util-1.5.4.tar.gz.md5
tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util
报错:configure: error: APR could not be located
./configure -with-apr=/usr/local/apr
cd /usr/local/httpd-2.4.18
增加参数 apr and apr-util
./configure -with-apr-util=/usr/local/apr-util
./configure -with-apr=/usr/local/apr
再次尝试:
./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
checking for APR-util... configure: error: the --with-apr-util parameter is incorrect.
大小写问题:
./configure -with-APR-util=/usr/local/apr-util
./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-nonportable-atomics --enable-mods-shared=most --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr/ --with-APR-util=/usr/local/apr-util/
make;
make install;
安装后一直再找启动文件;找了好久没找到;查看安装时候信息;
cd /usr/local/apache2/bin
./httpd -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.116.148.100. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
端口被占用;
cd ..
cd conf/
vim httpd.conf
listen 8080
再尝试
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.116.148.100. Set the 'ServerName' directive globally to suppress this message
访问ip:8080
It works!
实际上已经跑起来了。
解决下AH00558
cd /usr/local/apache2/conf
vim httpd.conf
增加 ServerName localhost:8080
重新尝试就可以了;