一直想用nginx,因为传说很快,可惜对f4f只在商用中支持,所以,暂时放弃,还是继续用用apache。
1、安装apache很简单,先
例行公事:sudo apt-cache search apache|grep apache,查找到里面的apache2,执行sudo
apt-get install apache2,很快就安装完,安装完后执行http://127.0.0.1,如果出现it
works,那就表示安装正确。
备注:Apache的默认文档根目录是在Ubuntu上的/var/www目录,配置文件是
/etc/apache2/apache2.conf。配置存储的子目录在/etc/apache2目录,apache重启命令:sudo
/etc/init.d/apache2 restart
2、安装mysql也很简单,先例行公事:sudo apt-cache
search mysql|grep server,可以看到里面的mysql-server后面跟着"metapackage depending
on the latest version",因此直接安装mysql-server可以获得最新版本。执行:sudo apt-get
install mysql-server mysql-client,安装完后执行mysql -uroot
-p,输入默认密码root,即可登录mysql client的操作界面。
mysql默认配置文件路径:/etc/mysql/my.cnf
3、
安装tomcat7,例行公事:sudo apt-cache search tomcat7,然后执行sudo apt-get install
tomcat7 tomcat7-admin。安装完毕后,在浏览器输入http://127.0.0.1:8080,出现it
works...表示你成功了。
备注:tomcat7一般放在/var/lib/tomcat7/webapps。
4、整合apache2和tomcat7
a、安装mod-jk,sudo apt-get install libapache2-mod-jk
b、
编辑tomcat配置文件:sudo nano /etc/tomcat7/server.xml ,讲”<Connector
port="8009" protocol="AJP/1.3" redirectPort="8443" />“的注释去掉。
c、在/etc/apache2/下新建workers.properties,sudo nano /etc/apache2/workers.properties,输入以下内容:
linux ubuntu mysql apache tomcat
原文:http://www.cnblogs.com/myprograms/p/4370538.html