Ubuntu下架设Tomcat+Apache+MySQL服务器

1.默认安装好Ubuntu 8.04 TLS Server版本(此版本支持到2013年04月)

2.安装ssh
#sudo apt-get install ssh

3.安装vsftpd
#sudo apt-get install vsftp
设置/etc/vsftpd.conf,由于不需要对外开放FTP,只是内网访问,相关设置如下.
#拒绝匿名用户,将其注释掉
#anonymous_enable=YES
#接受本地用户
local_enable=YES
#可以上传
write_enable=YES
#允许上传Ascii文件
ascii_upload_enable=YES
ascii_download_enable=YES
启动vsftpd
/etc/init.d vsftpd start

4.安装JDK5
apt-get install sun-java5-jdk
通过apt得安装JAVA环境自动会设置好.

5.安装TOMCAT6.018
自己去Tomcat官网下载好,通过FTP传上去
解压
tar zxvf apache-tomcat-6.0.18.tar.gz
复制到/usr/lib下面
#sudo cp /home/kejun/upload/apache-tomcat-6.0.18 /usr/lib/apache-tomcat-6.0.18

6.安装Apache2
sudo apt-get install apache2
通过apt安装的,apache的目录会有很多不同,这里安装完后并没有改动其中的配置文件.

7.安装JK(用于整合Tomcat和Apache)
#sudo apt-get install libapache2-mod-jk
查看一下在apache2的启动模块中是否有jk.load
#sudo ls /etc/apache2/mods-enabled/
配置workers.properties
#sudo vi /etc/libapache2-mod-jk/workers.properties
将下面两项改为自己的目录
workers.tomcat_home=/usr/lib/apache-tomcat-6.0.18
workers.java_home=/usr/lib/jvm/java-1.5.0-sun
接下来配置在apache2.conf
#sudo vi /usr/share/doc/libapache2-mod-jk/httpd_example_apache2.conf
复制里面的内容到apache2.conf
增加监听端口8081
#sudo vi /etc/apache2/ports.conf
增加一行
Listen 8081
修改虚拟主机
#sudo vi /etc/apache2/sites-available/default
根据自己设置,以下是我的设置
NameVirtualHost *:80
NameVirtualHost *:8081
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

DocumentRoot /var/www/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /var/log/apache2/error.log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

CustomLog /var/log/apache2/access.log combined
        ServerSignature On

Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

<VirtualHost *:8081>
        ServerAdmin webmaster@localhost
        DocumentRoot /usr/lib/apache-tomcat-6.0.18/webapps/idealshop
        ErrorLog /var/log/apache2/idealerror.log
        LogLevel warn
        CustomLog /var/log/apache2/idealaccess.log combined
        <Directory "/usr/lib/apache-tomcat-6.0.18/webapps/idealshop">
            Options FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
         </Directory>
</VirtualHost>
在tomcat的conf文件下增加文件jk2.properties
内容如下
handler.list=channelSocket,request
channelSocket.port=8009

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyfdjw.html