安装apache2.4.10
?
?
一:依賴安裝:apache依賴于apr,apr-util,pcre,所以需要先安裝他,并且需要最新的
apr官網:http://apr.apache.org/download.cgi
pcre官網:http://www.pcre.org/
?
apr,apr-util 與 apache的關系:
http://www.cnblogs.com/Alight/p/3997777.html
apache與pcre的關系:
PCRE被廣泛使用在許多開源軟件之中最著名的莫過于Apache HTTP服務器和PHP腳本語言R腳本語言此外正如從其名字所能看到的PCRE也是perl語言的缺省正則庫 PCRE是用C語言實現的其C++實現版本是PCRE++?
今日編譯apache時出錯:
#./configure --prefix……檢查編輯環境時出現:
checking for APR... no
configure: error: APR not found . Please read the documentation
解決辦法:
1.下載所需軟件包:
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2.編譯安裝:
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
具體步驟如下:
a:解決apr not found問題>>>>>>
[root@xt test]# tar -zxf apr-1.4.5.tar.gz
[root@xt test]# cd apr-1.4.5
[root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@xt apr-1.4.5]# make && make install
b:解決APR-util not found問題>>>>
[root@xt test]# tar -zxf apr-util-1.3.12.tar.gz
[root@xt test]# cd apr-util-1.3.12
[root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
[root@xt apr-util-1.3.12]# make && make install
c:解決pcre問題>>>>>>>>>
[root@xt test]#unzip -o pcre-8.10.zip
[root@xt test]#cd pcre-8.10
[root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre
[root@xt pcre-8.10]#make && make install
4.最后編譯Apache時加上:
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ \
--with-pcre=/usr/local/pcre
成功編譯完成~
?
二:編譯Apache
? [root@yahoo httpd-2.3.12-beta]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/? --with-pcre=/usr/local/pcre
?[root@yahoo httpd-2.3.12-beta]# make
?[root@yahoo httpd-2.3.12-beta]# make install
[root@yahoo httpd-2.3.12-beta]# /usr/local/apache2/bin/apachectl start
?
三:把apache加到系統服務里去
Apache加入啟動項里面:
echo '/usr/local/apache2/bin/apachectl start ' >> /etc/rc.local
Apache加入到系統服務里面:
cp /安裝目錄下/apache/bin/apachectl /etc/rc.d/init.d/httpd? (init.d中的腳本就相當于window中的注冊表,在系統啟動的時候某些指定的腳本被執行)
修改httpd
在文件頭部加入如下內容:
###
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description:http server
###
保存
在打入
#chkconfig --add httpd
#chkconfig --level 345 httpd on
?
參考:
http://www.111cn.net/sys/linux/49030.htm
http://blog.csdn.net/kobe_lzq/article/details/7976787
linux?下?apache啟動、停止、重啟命令
基本的操作方法:
本文假設你的apahce安裝目錄為/usr/local/apache2,這些方法適合任何情況
apahce啟動命令:
推薦/usr/local/apache2/bin/apachectl start apaceh啟動
apache停止命令
/usr/local/apache2/bin/apachectl stop?? 停止
apache重新啟動命令:
/usr/local/apache2/bin/apachectl restart 重啟
要在重啟 Apache 服務器時不中斷當前的連接,則應運行:
/usr/local/sbin/apachectl graceful
如果apache安裝成為linux的服務的話,可以用以下命令操作:
service httpd start 啟動
service httpd restart 重新啟動
service httpd stop 停止服務
?
Linux系統為Ubuntu
一、Start Apache 2 Server /啟動apache服務
# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start
二、 Restart Apache 2 Server /重啟apache服務
# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart
三、Stop Apache 2 Server /停止apache服務
# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop
?
錯誤類型:
錯誤一:啟動apache遇到錯誤:httpd: Could not reliably determine the server's fully qualified domain name
[root@server httpd-2.2.4]# /usr/local/apache/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
?
1)進入apache的安裝目錄:(視個人安裝情況而不同) [root@server ~]# cd /usr/local/apache/conf
?
2)編輯httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80
[root@server conf]# ls
extra? httpd.conf? magic? mime.types? original
[root@server conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName localhost:80
3)再重新啟動apache 即可。
[root@server ~]# /usr/local/apache/bin/apachectl restart
總結
以上是生活随笔為你收集整理的安装apache2.4.10的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CentOS6 安装配置Smokepin
- 下一篇: 学习官方示例 - System.Frac