July 26, 2008
Installations, Web
1 Comment
In order to have Tomcat listen on port 80, you either have to have it running as root (which by the way is not a very good idea), or configure a wrapper like JSCV.
Here is how you do it (This is an example using tomcat 6 please adapt to your install):
# cd /opt/apache-tomcat-6.0.16/bin/
# tar -zxvf jsvc.tar.gz
# cd jsvc-src
# chmod +x configure
# ./configure ; make
# cp jsvc ..
——————
Change your connection in server.xml to use port 80.
—————–
Start tomcat with a variation of the following init script:
tomcatjsvc.txt
As usual, let me know if you find any errors or a better way of doing it.
–JC
March 25, 2008
Web
No Comments
I was looking into a solution for a customer and mod_vhost_alias came in handy.
Lets say you want to host blogs for several people and you want to host them on the following subdomain format: blogname.crazyblogs.com. Instead of having a separate virtual host for each one, you can do something like this:
<VirtualHost 123.111.222.123:80>
UseCanonicalName Off
VirtualDocumentRoot /var/www/%0/htdocs
ServerName *.crazyblogs.com
</VirtualHost>
Now, if you go to http://blog1.crazyblogs.com, it will look for a index file inside /var/www/blog1.crazyblogs.com/htdocs.
You can find further information on:
http://httpd.apache.org/docs/2.0/vhosts/mass.html#simple
http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html
March 1, 2008
Web
No Comments
One of my co-workers today was working with mod_file_cache, and I thought I would put it in my blog. Customer had a lot of static files that were called a lot and wanted to reduce I/O wait without paying for a CDN. We thought mod_file_cache was the best solution.
The process is pretty straight forward and documented on apache docs so I will not post instructions, but let me know if you run into any problems. In a couple of weeks I will write a detailed post on how to use memcached for caching dynamic content. Below is the link from apache for mod_file_cache:
http://httpd.apache.org/docs/2.2/mod/mod_file_cache.html
–JC
February 22, 2008
Web
No Comments
I worked on a few Urchin migrations this month so I’m posting the steps. Very simple and straight forward:
1. First copy '/usr/local/urchin/data' directory from the old server to the same location on the new server.
2. On the old server, run:
/usr/local/urchin/util/uconf-export -f filename
and copy the output file to the new server
3. For a backup of the current config on the new server, run:
/usr/local/urchin/util/uconf-export -f filename
4. On the new server, run:
/usr/local/urchin/util/uconf-import -f filename
The filename should be the config from the old server, which you copied over in step 2. This should only import settings that do not already exist on the new server, so it will not overwrite any existing configuration.
Let me know if you guys have any questions or comments.
February 19, 2008
Installations, Web
5 Comments
This is a step by step stand alone installation of Tomcat 6
JDK Install:
fetch JDK @ http://java.sun.com/
# sh jdk-6u4-linux-i586-rpm.bin
accept license
set java home and path:
# JAVA_HOME=/usr/java/jdk1.6.0_04/
# export JAVA_HOME
# PATH=$JAVA_HOME/bin:$PATH
# export PATH
# which java
Make it happen at boot time:
# cd /etc/profile.d
# vi /etc/profile.d/jdk.sh
add the following lines to jdk.sh:
export JAVA_HOME=/usr/java/jdk1.6.0_04/ #(or the the location to java home if different)
export PATH=$JAVA_HOME/bin:$PATH
Installing Tomcat From Binary:
wget http://www.signal42.com/mirrors/apache/tomcat/tomcat-6/v6.0.16/bin/apache-tomcat-6.0.16.tar.gz
Untar:
# tar -zxvf apache-tomcat-6.0.16.tar.gz
Move it to /opt/ or desired location
# mv apache-tomcat-6.0.16 /opt/
For security, lets make it run under a underprivileged user:
# useradd tomcat -d /opt/apache-tomcat-6.0.16/temp/
Adjust permissions:
# chown -R tomcat:tomcat /opt/apache-tomcat-6.0.16/
Test install
[root@localhost opt]# sudo -u tomcat /opt/apache-tomcat-6.0.16/bin/startup.sh
or use startup script:
#vi /etc/init.d/tomcat
use the following script:
http://www.linuxzone.org/scripts/tomcat.txt
Add it to chkconfig and turn it on:
# chkconfig --add tomcat
# chkconfig tomcat on
That is it! Let me know if missed anything.