Saturday, 24 November 2012
Tomcat 6 - UTF 8
If you are having problems with utf-8 charset (lets say Turkish letters) what you need to do is to change the server.xml file located in $TOMCAT_HOME/conf as follows.
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" />
to
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
In Eclipse Indigo, find the directory named Servers ( the default name ) which is in the same level as other projects in project view. Find the server.xml file and change the above mentioned lines.
Cheers.
Monday, 5 November 2012
rsync local to remote
Example 4. Synchronize Files From Local to Remote
rsync allows you to synchronize files/directories between the local and remote system.
$ rsync -avz /root/temp/ thegeekstuff@192.168.200.10:/home/thegeekstuff/temp/
Centos apache mod_jk
Hi everybody.
Just wanted to share my 2 cents with you in case anyone wants to FFW coupling of Apache and Tomcat with mod_jk (Tomcat connector).
I followed some instructions found on the web but were specific for other distros (like Debian) so I have to improvise a bit. Here is my version:
prerequisites:
Install apache and tomcat using:
yum install httpd*
yum install tomcat*
This way I installed Apache 2.2.15 and Tomcat 6.0.24 from CentOS-6 repo. Default config locations are:
Apache: /etc/httpd/conf & /etc/httpd/conf.d
Tomcat: /etc/tomcat6 & /usr/share/tomcat6
Now for mod_jk:
PART_ONE (installation)
1. download tomcat-connector SOURCE from mirror that can be found on tomcat dwnld pages (I found it here )
2. copy the file (in my case tomcat-connectors-1.2.32-src.tar.gz) to /usr/src/
3. untar it:
4. go to /native subdirectory of untared package lets say SRC_HOME directory
5. now I found instructions to run ./building.sh script which wasn't able to do anything in my case since I missed a bunch of commands used inside. After reading SRC_HOME/native/BUILDING.txt :) I figured out I am not a developer and don't need to run this script but can go directly to running the script ./configure. Of course it reported that I need gcc which I didn't install with the OS initially so:
6. install gcc:
7. check that you have installed httpd-devel and have apxs (Apache eXtension tool) - I had it under /usr/sbin/apxs which was funny since I expected apxs2 which should be used for Apache 2.x
7. anyway I run configuration script using :
and the script finished successfully.
8. compile the stuff:
9. if you are lucky the you get the mod_jk.so file compiled in the SRC_HOME/native/apache-2.0/ directory. I also received a warning after compilation saying: libtool: install: warning: remember to run 'libtool --finish /usr/lib64/httpd/modules' - which I didn't run and I hope it will not hit me in the future like a boomerang :)
10. copy mod_jk.so file to Apache modules directory (in my case usr/lib64/httpd/modules):
11. end of part one :)
PART_TWO (configuration)
1. create workers properties file in Apache configuration directory (/etc/httpd/conf/):
2. put inside following lines (of course modify it per your needs and system settings):
for further reading please visit: Quick HowTo or Apache HowTo
3. I created the sepparate conf file for my mod_jk and put it into /etc/httpd/conf.d location under name myconf.conf.
I could do that since original Apache conf file (/etc/httpd/conf/httpd.conf) has enabled include of external conf files using directive:
4. inside myconf.conf put something like:
Of course there can be many JkMount directives to redirect specific URL's to Tomcat according to your needs.
5. restart Apache
6. end of part two :)
This should now redirect any URL: http//your-apache-server/myTomcatPages/ to Tomcat. Of course don't forget to open connenctions on a 8009 port which tomcat uses to listen to ajp13 calls (defined in server.xml conf file of Tomcat).
Hope it helps someone spend less time to make things work that it took me.
Best regards
Jani
Just wanted to share my 2 cents with you in case anyone wants to FFW coupling of Apache and Tomcat with mod_jk (Tomcat connector).
I followed some instructions found on the web but were specific for other distros (like Debian) so I have to improvise a bit. Here is my version:
prerequisites:
Install apache and tomcat using:
yum install httpd*
yum install tomcat*
This way I installed Apache 2.2.15 and Tomcat 6.0.24 from CentOS-6 repo. Default config locations are:
Apache: /etc/httpd/conf & /etc/httpd/conf.d
Tomcat: /etc/tomcat6 & /usr/share/tomcat6
Now for mod_jk:
PART_ONE (installation)
1. download tomcat-connector SOURCE from mirror that can be found on tomcat dwnld pages (I found it here )
2. copy the file (in my case tomcat-connectors-1.2.32-src.tar.gz) to /usr/src/
3. untar it:
tar xvf /usr/src/tomcat-connectors-1.2.32-src.tar.gz
4. go to /native subdirectory of untared package lets say SRC_HOME directory
cd /usr/src/tomcat-connectors-1.2.32-src/native
5. now I found instructions to run ./building.sh script which wasn't able to do anything in my case since I missed a bunch of commands used inside. After reading SRC_HOME/native/BUILDING.txt :) I figured out I am not a developer and don't need to run this script but can go directly to running the script ./configure. Of course it reported that I need gcc which I didn't install with the OS initially so:
6. install gcc:
yum install gcc*
7. check that you have installed httpd-devel and have apxs (Apache eXtension tool) - I had it under /usr/sbin/apxs which was funny since I expected apxs2 which should be used for Apache 2.x
7. anyway I run configuration script using :
./configure --with-apxs=/usr/sbin/apxs
8. compile the stuff:
make
9. if you are lucky the you get the mod_jk.so file compiled in the SRC_HOME/native/apache-2.0/ directory. I also received a warning after compilation saying: libtool: install: warning: remember to run 'libtool --finish /usr/lib64/httpd/modules' - which I didn't run and I hope it will not hit me in the future like a boomerang :)
10. copy mod_jk.so file to Apache modules directory (in my case usr/lib64/httpd/modules):
cp ./apache-2.0/mod_jk.so /usr/lib64/httpd/modules/
11. end of part one :)
PART_TWO (configuration)
1. create workers properties file in Apache configuration directory (/etc/httpd/conf/):
touch /etc/httpd/conf/workers.properties
2. put inside following lines (of course modify it per your needs and system settings):
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.lbfactor=1
for further reading please visit: Quick HowTo or Apache HowTo
3. I created the sepparate conf file for my mod_jk and put it into /etc/httpd/conf.d location under name myconf.conf.
touch /etc/httpd/conf.d/myconf.conf
I could do that since original Apache conf file (/etc/httpd/conf/httpd.conf) has enabled include of external conf files using directive:
Include conf.d/*.conf
4. inside myconf.conf put something like:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk_log
JkLogLevel info
JkMount /myTomcatPages/* worker1
Of course there can be many JkMount directives to redirect specific URL's to Tomcat according to your needs.
5. restart Apache
6. end of part two :)
This should now redirect any URL: http//your-apache-server/myTomcatPages/ to Tomcat. Of course don't forget to open connenctions on a 8009 port which tomcat uses to listen to ajp13 calls (defined in server.xml conf file of Tomcat).
Hope it helps someone spend less time to make things work that it took me.
Best regards
Jani
Subscribe to:
Posts (Atom)