Hits : 5304


Apache – Tomcat :: Mini How To 


Apache


https://httpd.apache.org/


$ wget -c http://apache.otenet.gr/dist/httpd/httpd-2.2.6.tar.bz2
$ tar jxvf httpd-2.2.6.tar.bz2 
$ cd httpd-2.2.6/
$ ./configure --prefix=/usr/local/httpd-2.2.6 --enable-modules=so --enable-ssl --enable-rewrite --with-ssl=/usr/local/ssl/ --enable-mods-shared='rewrite'
$ make
$ make install


Test conf and run apache


/usr/local/httpd-2.2.6/bin/httpd -t

/usr/local/httpd-2.2.6/bin/httpd -V

/usr/local/httpd-2.2.6/bin/httpd -k start

ps -ef | grep /ht[t]pd

curl http://localhost


top


Tomcat


https://tomcat.apache.org


# tomcat  5.5.23

wget -c http://apache.otenet.gr/dist/tomcat/tomcat-5/v5.5.23/bin/apache-tomcat-5.5.23.tar.gz
tar zxvf apache-tomcat-5.5.23.tar.gz
sudo mv apache-tomcat-5.5.23 /usr/local/
cd  /usr/local/
ln -s apache-tomcat-5.5.23 tomcat

groupadd tomcat
useradd tomcat -d /usr/local/tomcat -s /bin/bash -g tomcat
chown -R tomcat.tomcat /usr/local/apache-tomcat-5.5.23

echo "export -p JAVA_HOME=/usr/local/java" > /usr/local/tomcat/.bash_profile

su - tomcat -c "bin/catalina.sh start"


top


Java


# download JDK
http://java.sun.com/javase/index.jsp
jdk-6u2-linux-i586.bin

sh jdk-6u2-linux-i586.bin
mv jdk1.6.0_02 /usr/local
ln -s /usr/local/jdk1.6.0_02 /usr/local/java


top


Tomcat Connector


https://tomcat.apache.org/download-connectors.cgi


# apache - tomcat connector 1.2.25

wget -c http://apache.otenet.gr/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.25/tomcat-connectors-1.2.25-src.tar.gz
tar zxvf tomcat-connectors-1.2.25-src.tar.gz
cd tomcat-connectors-1.2.25-src/native/
./configure --with-apxs=/usr/local/httpd-2.2.6/bin/apxs
make
make install

ls -l /usr/local/httpd-2.2.6/modules/mod_jk.so
cp ./conf/workers.properties.minimal /usr/local/httpd-2.2.6/conf/workers.properties 
ls -l /usr/local/httpd-2.2.6/conf/workers.properties


top


Apache Conf


# vim /usr/local/httpd-2.2.6/conf/httpd.conf

ServerName localhost

# Load Module
LoadModule      jk_module       modules/mod_jk.so

# Define workers
JkWorkersFile     conf/workers.properties

# Logging
JkLogFile logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# Assigning URLs to Tomcat
JkMount /*.jsp tomcat5_5_23


top


Worker Conf


# vim /usr/local/httpd-2.2.6/conf/workers.properties

# Add this 
worker.list=tomcat5_5_23
worker.tomcat5_5_23.type=ajp13
worker.tomcat5_5_23.host=localhost
worker.tomcat5_5_23.port=8009


top


Server Xml Conf


# vim /usr/local/tomcat/conf/server.xml

<!-- Add this below <Engine name="Catalina" defaultHost="localhost"> -->

<!-- ebal -->
<Host name="www.ebal.gr" debug="0" appBase="/opt/www/www.ebal.gr" unpackWARs="false">
<Context path="" docBase="/opt/www/www.ebal.gr" debug="0" reloadable="true" crossContext="false"></Context>
<Alias>www.ebal.gr</Alias>
</Host>
<!-- ebal -->


top



Stop Tomcat


su - tomcat -c "bin/catalina.sh stop"

Apache Vhost


# vim /usr/local/httpd-2.2.6/conf/httpd.conf

# virtual host
<VirtualHost 127.0.0.13:80>
DocumentRoot /opt/www/www.ebal.gr
ServerName www.ebal.gr
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>
</VirtualHost>


top


/etc/hosts


echo "127.0.0.13     www.ebal.gr" >> /etc/hosts


top


Start Apache & Tomcat


/usr/local/httpd-2.2.6/bin/httpd -k restart
su - tomcat -c "bin/catalina.sh start"


top


Test jsp 


cat > /opt/www/www.ebal.gr/test.jsp


Formatter "highlight/html" not found


lynx http://www.ebal.gr/test.jsp


top


MySQL Connector


http://www.mysql.com/products/connector/j/


# 5.0.7

wget -c ftp://ftp.ntua.gr/mirror/mysql/Downloads/Connector-J/mysql-connector-java-5.0.7.tar.gz
tar zxfv mysql-connector-java-5.0.7.tar.gz
cp mysql-connector-java-5.0.7/mysql-connector-java-5.0.7-bin.jar /usr/local/tomcat/common/lib/
ls -l /usr/local/tomcat/common/lib/mysql-connector-java-5.0.7-bin.jar 

echo "export -p CLASSPATH=$CLASSPATH:"$CATALINA_HOME"/common/lib" >> /usr/local/tomcat/.bash_profile
su - tomcat -c "bin/catalina.sh stop"
su - tomcat -c "bin/catalina.sh start"


top


Test MySQL jsp 


cat > /opt/www/www.ebal.gr/mysql.jsp


Formatter "highlight/html" not found


lynx http://www.ebal.gr/mysql.jsp


top