日期:2014-05-16  浏览次数:20658 次

Linux(ubuntu)下apache与tomcat的整合(最新版)

(高手绕道)

?

目的是在 ubuntu 9.10 下安装 apache 2.2 +tomcat 6.0.20+jk 1.2.28.,当然在期间也复习了 linux下的基本命令,基本的 shell编程语句,如 :expr if while test 等 ,研究了下 tomcat的启动脚本。

?

一开始,肯定对 apache2一点也不熟悉,为了一次整合成功,做了很多的准备,包括看了很多的文章,就是没有看 apache的官网文档的,这是一个失误阿!

使用了 apt-get install apache2 .安装是成功了,但是不知道安装到那个目录下, google

下,通过如下方式找到 ubuntu下默认安装 apache2软件的路经 .

论坛指点:

默认安装路径如下:

/usr/bin /usr/lib /usr/share /usr/share/man

?

方法 1:在命令行输入: dpkg -L 软件包名;这里注意了软件包名,如 apache2软件包名为 apache2.(推荐这个方法)

方法 2:在 /var/cache/apt/archives找的你安装程序的包 ,然后用“ gdebi-gtk+软件包名”可以查看具体安装在什么位置。

?


?

?

?

参考: http://forum.ubuntu.org.cn/viewtopic.php?f=73&t=21990

?

默认安装后, apache2的路径非常乱,在本机电脑上安装路径如下:

/usr/

/usr/share/

/usr/share/doc

/usr/share/bug

/usr/share/apache2

?

太乱了,如是下手卸载,去 ubuntu software center 下载,结果 search一下,没有 apache。纳闷啊,我明明安装了,怎么在这里面没有了? Bug

另寻它法:(步骤如下)

1、 sudo apt-get remove apache2

2、 sudo apt-get remove apache2.2-common

3、 sudo apt-get autoremove (此命令会自动卸载 PHP)

卸载完成

成功卸载了吧?我这么想,去看看 /etc/目录下看看 ,apache2 在那里好好的,原来删除根本就不完全,

这样卸载软件,系统能用多久啊,

迟早一天硬盘会不够用的,系统运行速度会变慢的!于是 rm掉。

?

===========================================

至此, ubuntu默认安装默认卸载结束。重新到官网去下载 apache2.2 。根据 document安装

===========================================

另外记录一下启动 apache2 出现的错误以及解决办法:

?

?

?

?

1.Apache Address already in use: make_sock: could not bind to port 80 error and solution

?

First make sure port 80/443 is not used by any other service or application with netstat command:

# netstat -tulpn| grep :80

If port 80 is bind to httpd, kill all process:

# killall -r httpd

Now start the httpd:

# /etc/init.d/httpd start

Also make sure you are root while starting the httpd.

(后来这个很有用!)

?

?

另外参考:

  • http://timnity.iteye.com/blog/399453

  • http://www.cyberciti.biz/faq/apachehttpdaddress-already-in-use-make_sock-could-not-bind-to-port-80-or-443/

  • http://timnity.iteye.com/blog/277636

===============================================

?