Showing posts with label CODE time. Show all posts
Showing posts with label CODE time. Show all posts

Monday, April 7, 2014

Type of Issues which we get under Apache Tomcat

Type of Issues which we get under Apache/Tomcat:-
=====================================================================
A. Reducing the file size by compressing the existing files to reduce the used space on server.
  1. First we need to check the size of file system. File size of the different file systems can be known by command df -k 
  2. 1.       We can always check for file of bigger size and compress them if they are not compressed.
    sudo find . –size +5000000 |more
  3.  Suppose you have got the output of last command as :- “/export/apps/apache/app_instance/logs/access_log” , then go to the path where this file exists... path should be something like "/export/apps/apache/app_instance/logs"
  4. Then you need to go to the bin folder of this particular application, example for this file: - /export/apps/apache/app_instance/bin and then you have to stop the apache services with command - “sudo ./apachectl stop” 
  5. And to check if the instances are stopped or not then we need to run a command that will be: - “ps -ef|grep -i”.
  6. Once you are confirmed that all the instances are stopped then go and rename the file i.e. :- “sudo mv access_log access_log_current_date”.Once, name of file is change you can zip the log with command “sudo gzip access_log_current date”.
  7.  Now you can again check the file system with command df -k. It will be surely reduced file system then before. Side wise we should also restart the apache service that stopped, for this we will again have to go to “bin” directory (/export/apps/apache/app_instance/bin) and command  “sudo ./apachectl start” can be used to start the apache service.
  8. So once the services are started you need to do check the log directory if the new log file has been created or not and you need to do the same steps for all the files which you find under large files.
Note :- At times when we get other files as large files we need to check the time stamp of the files so that we can zip the files.

===================================================================


B. To redirect a particular website or a particular address to a different address.


Single address redirect can be done by adding a line to the conf file where the site is hosted.



Two types of redirection can be done.

1.)     Domain  redirection
2.)     Web page redirection.


1.)     Domain Redirection
Domain redirection is to redirect whole domain to of site to another site.
Above domain needs redirects to another site http://xxx5.lvs.domain1.com/dir4/dir5/     
NoteHost name –“dir4” must be mentioned in documented root as virtually
Document Root: /dir1/dir2/dir3/ (check on the path)

Open “httpd.conf” of apache in which you want to make the redirection.Use vi editor (make sure take the backup of configuration file before any changes in it)

  Run command - vi “httpd.conf” and then add
    Document Root /dir1/dir2/dir3/dir4/dir5/ 
    Server Name        www.a1.domain1.com 
    Server Alias         a1.domain1.com 
    Redirect permanent  /   http://xxx5.lvs.domain1.com/dir4/dir5/ 

There after recycle same Apache to affect the changes.

2.)     Web page redirection.
Web page redirection is permanent redirection of link to another link; it redirects always link to domain or link to domain+directoty/link – (whole web page).

Link - /dir1/dir2/

It will redirect the link “/dir1/dir2/” to desired web page, it does not take prefixed domain name
Whatever the domain name is prefixed to link it will redirect to desired web page.
User wants to redirect the link - /dir1/dir2/  which is mentioned in documented root of  application, to http://qwerty.domain.com/display/ddmx/Home.
Whatever domain prefixed   to link it ignores the domain and redirects the link to desired site.
Example:
xxx1.lvs.domain.com/dir1/dir2/ 
or xxx2.lvs.domain.com/dir1/dir2/  
or xxx5.lvs.domain.com/dir1/dir2/  
after changes in configuration for redirection to desired site, it will concentrate to link only and open the other site.
                                     http://qwerty.es.domain.com/a/b/Home.

Path - :/export/apps/apache/Apache2.0.54/conf
File - httpd.conf
Vi httpd.conf and add the below line in redirection parameter of file.

Redirect permanent   /dir1/dir2/index.html  “http://qwerty.es.dupont.com/a/b/Home

Recycle Apache after addition in file to affect the changes.

Note;- Before redirecting, first we need to check if single address needs to be redirected to a different address or a new website is hosted on our server



=====================================================================


C. To change the look of the URL

Re-write Engine modifies a web URL's appearance. This modification is called URL rewriting. Rewritten URLs are used to provide shorter and more relevant-looking links to web pages.
Re-write redirects the URL to the directory of webapps in which war file is deployed. It redirects the URL of application to folder where war file of application is deployed.
Let’s take an example
There is a URL - http://app-dev.lvs.domain1.com , if we click on URL then the actual web page does not come up, it opens “tomcat successfully installation page”. The actual web page is http://app-dev.lvs.domain1.com/app-war-d . I had to write complete URL along with /app-war-d.  to  get the actual web page.

Re-write rule comes in picture now; Re-write engine redirect the JK_Mount in httpd.conf file in instance directory on server.
Login to the server on which the application is hosted .Go to the directory of apache of instance and make changes in httpd.conf file of application.
Export/apps/apache//conf

vi edit the httpd.con file. There is Re-write Engine Module in configuration file.

JK Mount mounting application to URL
Uncomment the RewriteRule by remove the “# key” and then replace the re-write folder name with the name of folder in which war file of application is deployed. Navigate the directory export/apps/tomcat///webapps , in webapps there could be folder(suppose 'app-air-d') in which war file must be deployed , so use the name of that folder in which war file deployed.

RewriteEngine On
RewriteRule  ^/$  /app-air-d/ [R]
#JkMount /* app-dev

Recycle the apache of instance to get the changes affected. Try to open the URL http://app-dev.lvs.domain1.com and it will redirect to substitute directory http://app-dev.lvs.domain.com/app-war-d.

@ Important


  1. Make sure Re-write Engine should be ON, in httpd.conf file of apache.
  2. An ISO file mod_rewrite.so file must be saved on module director of apache. I fit is not there then download it and copy into module directory. 
=====================================================================

D. MIME TYPE updation
The Multipurpose Internet Mail Extensions (MIME) types file contains mappings between file extensions and MIME types. This file is utilized during request processing to tell the server what type of resource is being requested. It bases this information on the extension of the resource (such as .txt, .html, or .cgi) and associates a type, language, or encoding method based on the extension.
Multipurpose Internet Mail Extensions (MIME) is an Internet standard that extends the format of email to support.
An Internet media type is a standard identifier used on the Internet to indicate the type of data that a file contains.
email clients use them to identify attachment files,
    web browsers use them to determine how to display or output files that are not in HTML format,
    search engines use them to classify data files on the web.
  
There are 3 things in MIMI TYPE updations
1.    File Type – Characteristics of the file , weather it is HTML , EXEL , WORD DOC., PPT like ...
2.    File Extension – The Extension of file after “.” .doc, .xls, .ppt,.html.
3.    MIMI TYPE - Type of Application format. Like template , micro

MIMI TYPE is arranged alphabetically, The MIMI TYPE is divided in 3 parts and all 3 parts are arranged alphabetically.
Example.
application/vnd.openxmlformats-officedocument.wordprocessingml.document  
application/vnd.ms-word.document.macroEnabled.12  
application/vnd.openxmlformats-officedocument.wordprocessingml.template  
application/vnd.ms-word.template.macroEnabled.12  
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet  
application/vnd.ms-excel.sheet.macroEnabled.12  
application/vnd.openxmlformats-officedocument.spreadsheetml.template  
application/vnd.ms-excel.template.macroEnabled.12  
application/vnd.ms-excel.sheet.binary.macroEnabled.12  
application/vnd.ms-excel.addin.macroEnabled.12  
application/vnd.openxmlformats-officedocument.presentationml.presentation  
application/vnd.ms-powerpoint.presentation.macroEnabled.12  
application/vnd.openxmlformats-officedocument.presentationml.slideshow  
application/vnd.ms-powerpoint.slideshow.macroEnabled.12  
application/vnd.openxmlformats-officedocument.presentationml.template  
application/vnd.ms-powerpoint.template.macroEnabled.12  
application/vnd.ms-powerpoint.addin.macroEnabled.12  
application/vnd.openxmlformats-officedocument.presentationml.slide  
application/vnd.ms-powerpoint.slide.macroEnabled.12  
application/onenote  
application/onenote  
application/onenote  
application/onenote  
application/vnd.ms-officetheme
Alphabetically arranged MIMI TYPE at below.
application/onenote  
application/onenote  
application/onenote  
application/onenote  
application/vnd.ms-excel.addin.macroEnabled.12  
application/vnd.ms-excel.sheet.binary.macroEnabled.12  
application/vnd.ms-excel.sheet.macroEnabled.12  
application/vnd.ms-excel.template.macroEnabled.12  
application/vnd.ms-officetheme
application/vnd.ms-powerpoint.addin.macroEnabled.12  
application/vnd.ms-powerpoint.presentation.macroEnabled.12  
application/vnd.ms-powerpoint.slideshow.macroEnabled.12  
application/vnd.ms-powerpoint.slide.macroEnabled.12  
application/vnd.ms-powerpoint.template.macroEnabled.12  
application/vnd.ms-word.document.macroEnabled.12  
application/vnd.ms-word.template.macroEnabled.12  
application/vnd.openxmlformats-officedocument.presentationml.presentation  
application/vnd.openxmlformats-officedocument.presentationml.slideshow  
application/vnd.openxmlformats-officedocument.presentationml.slide  
application/vnd.openxmlformats-officedocument.presentationml.template  
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet  
application/vnd.openxmlformats-officedocument.spreadsheetml.template  
application/vnd.openxmlformats-officedocument.wordprocessingml.document  
application/vnd.openxmlformats-officedocument.wordprocessingml.template  
Please go through the above example to arrange the MIMI TYPE.








Wednesday, February 26, 2014

Install new Apache instance on AIX

This blog will help a Apache aspirant to install a Apache on his AIX machine.

Prerequisites
  1.  Download Apache software [  Ref:- http://httpd.apache.org/download.cgi ]
  2. AIX Machine
  3. Essential libraries- The GNU C compiler (gcc) from the Free Software Foundation (FSF) is recommended (version 2.7.2 is fine). It’s libraries are also needed. It’s necessary to have math library (math.h) installed too. like autoconf ,   gzip, GNU make, GNU diffutils, autogen, GNU libtool 1.4.2 or higher, GNU m4, automake,  gperf, expect, GNU Bison, patch, tar, bzip2, bash shell
  4. Memory space- about 10 MB of memory is occupied by the Apache and 100 MB of temporary memory during the installation
  5. Users and group
  6. IP address/ domain name for instance- I am assuming with IP "xx.XX.xxx.XXX" and domain name "app_name.domain.com"

Procedure
cdcux00:neha:/export/apps/apache/app_name> gunzip -c httpd-2.0.65.tar.gz 

cdcux00:neha:/export/apps/apache/app_name> ls -lrt 

total 58664
-rw-r-----    1 apache   www        30023680 Feb 25 06:18 httpd-2.0.65.tar

cdcux00:neha:/export/apps/apache/app_name> tar -xvf httpd-2.0.65.tar

This will extract the folder.

cdcux00:neha:/export/apps/apache/app_name> ls -lrt

-rw-r-----    1 apache   www        30023680 Feb 25 06:18 httpd-2.0.65.tar
drwxr-s--x   12 apache   www            4096 Feb 25 06:37 httpd-2.0.65

cdcux00:neha:/export/apps/apache/app_name> mkdir app_name-apache

cdcux00:neha:/export/apps/apache/app_name> ls -lrt

total 58664
-rw-r-----    1 apache   www        30023680 Feb 25 06:18 httpd-2.0.65.tar
drwxr-s--x   12 apache   www            4096 Feb 25 06:37 httpd-2.0.65
drwxr-s--x   15 apache   www            4096 Feb 25 06:39 app_name-apache

cdcux00:neha:/export/apps/apache/app_name> cd httpd-2.0.65

cdcux00:neha:/export/apps/apache/app_name/httpd-2.0.65> ls -lrt
total 2976
-rw-r-----    1 apache   www             367 Nov 24 2004  emacs-style
-rw-r-----    1 apache   www           10943 Nov 24 2004  config.layout
-rw-r-----    1 apache   www          189152 Nov 24 2004  apachenw.mcp.zip
-rw-r-----    1 apache   www              72 Nov 24 2004  acconfig.h
-rw-r-----    1 apache   www            8180 Nov 24 2004  VERSIONING
-rw-r-----    1 apache   www            3876 Nov 24 2004  README.platforms
-rw-r-----    1 apache   www            8355 Nov 24 2004  Makefile.in
-rw-r-----    1 apache   www            5216 Nov 24 2004  LAYOUT
-rw-r-----    1 apache   www            2912 Nov 24 2004  InstallBin.dsp
-rw-r-----    1 apache   www            2688 Nov 24 2004  BuildBin.dsp
-rw-r-----    1 apache   www           14882 Nov 24 2004  ABOUT_APACHE
-rw-r-----    1 apache   www            7110 Nov 24 2004  .gdbinit
-rw-r-----    1 apache   www           16062 Jul  5 2006  libhttpd.dsp
-rw-r-----    1 apache   www            4190 Jul  5 2006  Apache.dsp
-rwxr-x--x    1 apache   www            5300 Jul 12 2006  buildconf
-rw-r-----    1 apache   www            5909 Jan 10 2007  README
-rw-r-----    1 apache   www           16392 Jan  7 2008  acinclude.m4
-rw-r-----    1 apache   www           28563 Jan 18 2008  LICENSE
-rw-r-----    1 apache   www           39666 Nov 13 2008  Apache.dsw
-rw-r-----    1 apache   www           19408 May 29 2009  configure.in
-rw-r-----    1 apache   www           29213 Oct 18 2010  Makefile.win
-rw-r-----    1 apache   www           11004 Sep 14 2011  NWGNUmakefile
-rw-r-----    1 apache   www            3947 Jan 17 2012  INSTALL
-rw-r-----    1 apache   www          326143 Jun 26 2013  CHANGES
-rw-r-----    1 apache   www             828 Jun 26 2013  NOTICE
drwxr-s--x    9 apache   www             256 Jun 28 2013  docs
-rw-r-----    1 apache   www           16825 Jun 28 2013  httpd.spec
-rwxr-x--x    1 apache   www          482547 Jun 28 2013  configure
-rwxr-x--x    1 apache   www             160 Feb 25 06:28 config.nice
-rw-r-----    1 apache   www             957 Feb 25 06:30 modules.c
-rwxr-x--x    1 apache   www           39349 Feb 25 06:30 config.status
drwxr-s--x    2 apache   www            4096 Feb 25 06:30 test
drwxr-s--x    5 apache   www             256 Feb 25 06:30 srclib
drwxr-s--x    9 apache   www            4096 Feb 25 06:30 os
drwxr-s--x   17 apache   www            4096 Feb 25 06:30 modules
-rw-r-----    1 apache   www            8620 Feb 25 06:30 Makefile
-rw-r-----    1 apache   www               0 Feb 25 06:30 .deps
drwxr-s--x    2 apache   www            4096 Feb 25 06:30 include
-rw-r-----    1 apache   www           52766 Feb 25 06:30 config.log
drwxr-s--x    5 apache   www            4096 Feb 25 06:30 build
drwxr-s--x    4 apache   www            4096 Feb 25 06:37 server
drwxr-s--x    5 apache   www            4096 Feb 25 06:37 support
-rw-r-----    1 apache   www           50710 Feb 25 06:37 modules.o
-rw-r-----    1 apache   www             312 Feb 25 06:37 modules.lo
-rwxr-x--x    1 apache   www            6773 Feb 25 06:37 httpd
drwxr-s--x    2 apache   www             256 Feb 25 06:37 .libs

I am assuming that you are not logged in with apache ID so the I am using "sudo" with each command.

cdcux00:neha:/export/apps/apache/app_name/httpd-2.0.65> sudo ./configure --enable-mods-shared=most --prefix=/export/apps/apache/app_name --with-mpm=worker


Similarly it could also be installed under a folder inside any directory residing in the "app_name" folder

cdcux00:neha:/export/apps/apache/app_name/httpd-2.0.65> sudo ./configure --enable-mods-shared=most --prefix=/export/apps/apache/app_name/app_name-apache --with-mpm=worker


cdcux00:neha:/export/apps/apache/app_name/httpd-2.0.65>sudo make

Till these two steps you will not be able to see the apache installed

cdcux00:neha:/export/apps/apache/app_name/httpd-2.0.65> sudo make install

after this step you will be able to see the apache installed.

cdcux00:neha:/export/apps/apache/app_name/app_name-apache>ls -lrt
total 96
drwxr-sr-x    2 apache   www            4096 Feb 25 06:39 lib
drwxr-sr-x    2 apache   www            4096 Feb 25 06:39 modules
drwxr-sr-x    2 apache   www            4096 Feb 25 06:39 htdocs
drwxr-sr-x    3 apache   www            4096 Feb 25 06:39 error
drwxr-sr-x    2 apache   www            4096 Feb 25 06:39 conf
drwxr-sr-x    4 apache   www             256 Feb 25 06:39 man
drwxr-sr-x    2 apache   www             256 Feb 25 06:39 logs
drwxr-sr-x    2 apache   www            4096 Feb 25 06:39 include
drwxr-sr-x    3 apache   www            8192 Feb 25 06:39 icons
drwxr-sr-x    2 apache   www             256 Feb 25 06:39 cgi-bin
drwxr-sr-x   14 apache   www            8192 Feb 25 06:40 manual
drwxr-sr-x    2 apache   www            4096 Feb 25 06:40 build
drwxr-sr-x    2 apache   www            4096 Feb 25 06:40 bin

Thus the apache is installed.

Setting the configurations

cdcux00:neha:/export/apps/apache/app_name/app_name-apache/conf>ls -lrt
total 360
-rw-r--r--    1 apache   www           53011 Feb 25 06:39 mime.types
-rw-r--r--    1 apache   www           12958 Feb 25 06:39 magic
-rw-r--r--    1 apache   www            2083 Feb 25 06:39 highperformance.conf
-rw-r--r--    1 apache   www           11380 Feb 25 06:39 ssl.conf
-rw-r--r--    1 apache   www           11380 Feb 25 06:39 ssl-std.conf
-rw-r--r--    1 apache   www           37103 Feb 25 06:39 httpd.conf
-rw-r--r--    1 apache   www           37103 Feb 25 06:39 httpd-std.conf
-rw-r--r--    1 apache   www            2083 Feb 25 06:39 highperformance-std.conf

file " httpd-std.conf" is the copy of the httpd.conf. Even then you can't find it, take backup of current httpd.conf (to be on safer side) and then do the following changes.

cdcux00:neha:/export/apps/apache/app_name/app_name-apache/conf>vi httpd.conf

Listen  xx.XX.xxx.XXX:80

ServerName app_name.domain.com

User apache
Group www

for directory index page
 make a html file named "mytesting.html" and keep this inside "cdcux00:neha:/export/apps/apache/app_name/app_name-apache/htdocs"

make following changes in the httpd.conf file 

DirectoryIndex mytesting.html

Now restart the Apache. now when you will look up " app_name.domain.com" on internet explorer this will show the page "mytesting.html" that you made.

Monday, December 24, 2012

Application Deployment

Application Deployment


Introduction

Application deployment is the deployment of the new war file on the server. New War file contains the new changes that are made into the site by the developer.

Procedures

1. Get the file from the person through mail or the sametime.

2. FTP from desktop to the server(xxx615.lvs.owner.com)

i) Change the path to place where file is stored

C:

( this will change the directory to c directory from any other directory)

ii) ftp xxx615.lvs.owner.com(server name)

Server will ask for the username and password, enter the password specific to that server.

iii) Now we have to end the file from our desktop to the UNIX server. File transfer can take place in 2 ways- ASCII or BIN.

For unix  windows – use ASCII (ASC)

For windows  unix – use Binary (BIN)

We are using BIN so next command is

BIN

iv) Put application1.war



This will put the file to server in your user directory.

v) Now check in the server if file has been FULLY transferred or not.

Ls-lt

3. Now file will have rights of staff ownership. Its ownership should be changed to be application1

sudo chown application1:www application1.war

4. Presently we are working in our directory(sn2381123), now, Change to application1 user ID to be able to use the ownership

sudo su application1

5. Go the bin tomcat folder of application1 application

cd /export/apps/tomcat/application1-dev/tomcat-5.0.28/bin


6. Stop the tomcat for application1 application

./stop-tomcat.sh
7. xxx615:root:/export/apps/tomcat/application1-dev/tomcat-5.0.28/bin>ps -ef
grep java

8. copy the result in the notepad it will look something like this
Epreseg is not visible that means, it is not working.
9. Come to webapps folder

cd /export/apps/tomcat/application1-dev/tomcat-5.0.28/webapps

cp /export/apps/tomcat/application1-dev/tomcat-5.0.28/webapps/application1/application1.war . (Current directory)

10. copy new application1.war to /export/apps/tomcat/application1-dev/tomcat-5.0.28/webapps/application1

cd /export/apps/tomcat/application1-dev/tomcat-5.0.28/webapps/application1

cp /home/devuser/EP_Test_June_02/application1.war .

11. then under application1 folder delete everything , except “monitor” folder and application1.war

rm -rf *.jsp

Command to remove all the jsp files, then remove all the remaining folders

rm -rf META-INF WEB-INF env image application1.war script style vssver2.scc

12. Deploy the war file under application1 folder using following command

/usr/java6_64/bin/jar -xvf application1.war

13. Start the Application

cd /export/apps/tomcat/application1-dev/tomcat-5.0.28/bin

./start-tomcat.sh
14. xxx615:root:/export/apps/tomcat/application1-dev/tomcat-5.0.28/bin>ps -ef
grep java
this will show all the  "java"process running (if any)

15. logout from application1 user

exit

16. check the log file if the server is started or not

cd /export/apps/tomcat/application1-dev/tomcat-5.0.28/logs

Ls –lrt
17. The file in the end is “catalina.out”

Tail –f catalina.out

Open this file to see if the server is started or not

18. Also check the application site to check if it is still working.

Friday, October 19, 2012

Making your existing project to breath in Eclipse IDE


Always enter the Parent directory of the project as work space while opening the Eclipse.

To open the project:
Goto File à import… à Existing Project into Workspace à “c:\Projectpath\” à Finish

Open the Java perspective

Window  à Open perspective  àJAVA

Left side shows the Workspace

                To compile:
                                Open Ant (Window à Show View à Ant)
                                Add build.xml(ANT's .xml file for the build)to the list of build files
                                Run target “default” (or any target that seems to build Project)


To compile and debug in eclipse:
Make sure that Project à “Build Automatically” is checked, (project will compile when it is opened)
                Debug Configuration à Debug… à à New à
Type into project: “tips-pm”
Type into “Main class” common.Main
Click on Arguments Tab
type in “DEBUG RUNDEV" (or any required default argument in the your project) username  password  where “username …” are optional
                                                Click on Apply à Run
                                Next time you can just press F11