UnixServerAdmin

Server Administration & Management

tomcat_httpd.conf_virtual-hosting for Java + PHP

We can run java and PHP based websites on same servers, Here are six websites, in which four are based on Java and two are based on PHP

1. http://revenue.unixserveradmin.com – Java
2. http://revenue.unixserveradmin.com – Java
3. http://revenue.unixserveradmin.com – Java
4. http://revenue.unixserveradmin.com – Java
5. http://noc.unixserveradmin.com – PHP
6. http://online.unixserveradmin.com – PHP

# vim /etc/httpd/conf/httpd.conf

Line No. 201 to 212

#############################################################
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/worker.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel info
JkLogStampFormat “[%a %b %d %H:%M:%S %Y] ”
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat “%w %V %T”
JkEnvVar SSL_CLIENT_V_START
JkMount /revenue* tomcat1
JkMount /mis* tomcat2
JkMount /sms* tomcat3
JkMount /sla* tomcat4

#############################################################
For Java Hosting
#############################################################

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName revenue.unixserveradmin.com
ServerAlias http://www.revenue.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /revenue/$1[L,PT]
JkMount /* tomcat1
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName mis.unixserveradmin.com
ServerAlias http://www.mis.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /mis/$1[L,PT]
JkMount /* tomcat2
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName sms.unixserveradmin.com
ServerAlias http://www.sms.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /sms/$1[L,PT]
JkMount /* tomcat3
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
ServerName sla.unixserveradmin.com
ServerAlias http://www.sla.unixserveradmin.com
RewriteEngine On
RewriteLog logs/apache-mod_rewrite
RewriteRule ^/(.*)$ /sms/$1[L,PT]
JkMount /* tomcat4
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

#############################################################
For PHP Hosting
#############################################################

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
DocumentRoot /var/www/html/noc/
ServerName noc.unixserveradmin.com
ServerAlias http://www.noc.unixserveradmin.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@unixserveradmin.com
DocumentRoot /var/www/html/online/
ServerName online.unixserveradmin.com
ServerAlias http://www.online.unixserveradmin.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

#############################################################

March 30, 2014 Posted by | Apache, Tomcat | , | Leave a comment

worker.properties_virtual-hosting

##############################################################
# workers to contact, that’s what you have in your httpd.conf
# here are four different tomcat server, running on different ports
# tomcat1 for revenue portal
# tomcat2 for mis portal
# tomcat3 for sms portal
# tomcat for sla portal
##############################################################

worker.list=tomcat1, tomcat2, tomcat3, tomcat4

# setup tomcat1
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13

# setup tomcat2
worker.tomcat2.port=8109
worker.tomcat2.host=localhost
worker.tomcat2.type=ajp13

# setup tomcat3
worker.tomcat3.port=8209
worker.tomcat3.host=localhost
worker.tomcat3.type=ajp13

# setup tomcat4
worker.tomcat4.port=8309
worker.tomcat4.host=localhost
worker.tomcat4.type=ajp13
##############################################################

# worker.list –> Describe the workers that are available to Apache via a list
# ajp13 –> This type of worker represents a running Tomcat instance

March 20, 2014 Posted by | Apache, Tomcat | , | Leave a comment

disk_speed.sh

###########################################################
## disk_speed.sh ##
###########################################################
## Make a Directory /REPORTS ##
## Make a file msg.txt under /REPORTS Directory ##
## Write Following in msg.txt file ##
###########################################################
## Hi, ##
## The Disk Speed of Hard Drive in the server has been done. ##
## For Disk Speed Report, please check the attachment. ##
## Thanks & Regards, ##
## Unixserveradmin.com Security Team ##
###########################################################
#! /bin/bash

/bin/echo “=================================” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “THE Disk Speed Report of  Hard Drive in Server $(hostname) at $(date)” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “=================================” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/echo “Check Write Speed of Hard Drive”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “——————————–”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/dd if=/dev/zero of=test bs=1048576 count=2048  2>&1 | tee -a /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/echo “Check Read Speed of Hard Drive”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “——————————–”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

/bin/dd if=/dev/zero of=test bs=1048576 count=2048  2>&1 | tee -a /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo ”      ” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/echo “=================================” >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt

#/bin/echo “Remove test file from Hard Drive”  >> /REPORTS/disk_speed.log_$(date +%d%m%y).txt
/bin/rm -rvdf test

mutt -s “Disk Speed Report of Server $(hostname | tr ‘a-z’ ‘A-Z’)” -a /REPORTS/disk_speed.log_$(date +%d%m%y).txt — unixserv@unixserveradmin.com   info@unixserveradmin.com < /REPORTS/msg.txt

March 10, 2014 Posted by | Shell Script | | 1 Comment