下載軟體包: 首先需要安裝apr和apr-util 安裝apr-util: ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr sudo make sudo make install 這兩個必不可少,如果缺少其他的依賴 ...
下載軟體包:
wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.33.tar.gz wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
首先需要安裝apr和apr-util
tar xf apr-1.6.3.tar.gz cd apr-1.6.3/ ./configure sudo make sudo make install
安裝apr-util:
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
sudo make
sudo make install
這兩個必不可少,如果缺少其他的依賴,請自行百度
安裝apr-util的,在編譯的時候報錯:
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
解決方法:
sudo apt-get install libexpat1-dev
還有其他依賴:
1,pcre
sudo apt-get install libpcre3 libpcre3-dev
2,openssl
sudo apt-get install openssl libssl-dev
3,zlib
sudo apt-get install zlib1g-dev
編譯apache
./configure \ --prefix=/usr/local/httpd24 \ --sysconfdir=/etc/httpd24 \ --enable-so \ --enable-ssl \ --enable-cgi \ --enable-rewrite \ --with-zlib \ --with-pcre \ --with-mpm=prefork \ --enable-modules=most \ --enable-mpms-shared=all
最後make makeinstall
root@dev:~# /usr/local/httpd24/bin/apachectl start root@dev:~# ps -ef | grep httpd root 24411 17534 0 06:15 ? 00:00:00 /usr/local/httpd24/bin/httpd -k start daemon 24412 24411 0 06:15 ? 00:00:00 /usr/local/httpd24/bin/httpd -k start daemon 24413 24411 0 06:15 ? 00:00:00 /usr/local/httpd24/bin/httpd -k start daemon 24414 24411 0 06:15 ? 00:00:00 /usr/local/httpd24/bin/httpd -k start daemon 24415 24411 0 06:15 ? 00:00:00 /usr/local/httpd24/bin/httpd -k start daemon 24416 24411 0 06:15 ? 00:00:00 /usr/local/httpd24/bin/httpd -k start root 24418 24367 0 06:15 pts/19 00:00:00 grep --color=auto httpd
修改配置文件( vim /etc/httpd24/httpd.conf )
ServerName 127.0.0.1
DocumentRoot 後面指定一個網站根目錄