in the on the Linux platform is left on the site platform is LAMP or lnmp, in fact, there is a more extensive use of Java language written in the Web program JSP, The Java runtime requires the JDK(Java Development Kit) to be a product developed by Sun Microsystems. JSP program can use Tomcat, it is a project of the Apache Software Foundation, it is technologically advanced, stable performance, is a more popular Web application Server, in addition, There is also an open source resin can also parse the JSP program, it has a commercial version called Resinpro.
System Platform: CentOS Release 6.7 (Final)
Hostname:balichvm (192.168.171.51)
JDK version:jdk1.7.0_79
Resin version:resin-4.0.46
1), download, configure JDK
[Email protected] ~]# cd/usr/local/src/
[Email protected] src]# wgethttp://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz # Download
[[Email protected] src]# tar zxvfjdk-7u79-linux-x64.tar.gz # Unzip
[[Email protected] src]# MV JDK1.7.0_79//USR/LOCAL/JDK # Move program and rename
2), configure the JDK environment variables, in the/etc/profile.d/ directory, edit a java.sh Java environment variable file, configured as follows
[Email protected] src]# vim/etc/profile.d/java.sh
Java_home=/usr/local/jdk
Java_bin=/usr/local/jdk/bin
Jre_home=/usr/local/jdk/jre
Path= $PATH:/usr/local/jdk/bin:/usr/local/jdk/jre/bin
Classpath=/usr/local/jdk/jre/lib:/usr/local/jdk/lib:/usr/local/jdk/jre/lib/charsets.jar
Save configuration file
[Email protected] src]# source/etc/profile.d/java.sh
[[email protected] src]# java–version # test environment variables are normal
Java Version "1.7.0_79"
Java (TM) SE Runtime Environment (BUILD1.7.0_79-B15)
Java HotSpot (TM) 64-bit Server VM (build24.79-b02, Mixed mode)
[Email protected] src]#
3), download and install resin.
Resin is also like Tomcat, the program used to parse the JSP , also need the support of the JDK, the installation method is the same.
Resin 's official website is:http://caucho.com/, open source version resin, and commercial version Resinpro, where the use of open source resin Version.
[[email protected] src]# wgethttp://caucho.com/download/resin-4.0.46.tar.gz # Download
[[email protected] src]# tar-zxvfresin-4.0.46.tar.gz # Unzip
[[email protected] resin-4.0.46]#./configure--prefix=/usr/local/resin--WITH-JAVA-HOME=/USR/LOCAL/JDK # Configuring compilation parameters
Resin Configuration Summary:
resin:4.0.46
Home:/usr/local/resin
Root:/usr/local/resin
Conf:/usr/local/resin/conf
LOG:/usr/local/resin/log
Plugins:common Resin_os
Init:/etc/init.d/resin
Java_home:/USR/LOCAL/JDK
Jni:64-bit
Include:-i/usr/local/jdk/include-i/usr/local/jdk/include/linux
CFLAGS:
Cflags_shlib:-fpic
ld_shlib:gcc
Ldflags_shlib:-shared-fpic-m64
Libs_shlib:
Epoll () for keepalives
[[email protected] resin-4.0.46]# make&& make install # compile and install
4), start resin
[Email protected] resin-4.0.46]#/etc/init.d/resinstart
Starting resin:. # start, one point indicates successful start
this can be accessed via the browser:http://ip:8080, resin is alsothe8080 port by default .
5),resin configuration, combined with JSP.
Resin Default profile is:/usr/local/resin/conf/resin.xml, and Tomcat configuration is a bit similar, both are XML files, the virtual host is used paired presence. write the configuration information under <clusterid= "app" > last , configure a virtual host as java.balichvm.org, The virtual host configuration is as follows:
[[email protected] resin-4.0.46] #mkdir/data/javaweb # Create a Site Directory
[[email protected] resin-4.0.46]# Vim/usr/local/resin/conf/resin.xml # Edit configuration file
<web-app id= "/" root-directory= "/data/javaweb"/>
After adding the above content, save the configuration file.
6), restart the resin service, test
[[email protected] Resin-4.0.46]#/etc/init.d/resin Restart # Restart service
Stopping resin:.
Starting resin:.
[Email protected] resin-4.0.46]#
in the/data/javaweb directory to write a jsp file, using a Java time function, if the normal display of the current time, it indicates that the JSP environment is basically OK.
[Email protected] tomcat]# vim/data/javaweb/timenow.jsp
<body>
<center> now time is <%=new java.util.Date ()%></center>
</body>
Save the file, test it.
[[Email protected] ~]# Date
year in month Monday 11:51:45 CST
[Email protected] ~]# curl-xlocalhost:8080java.balichvm.org/timenow.jsp
<body>
<center> now time is Mon Nov 11:51:47 CST </center>
</body>
[Email protected] ~]#
has been normal parsing, indicating that the use of resin has completed the environment of JSP construction.
This article is from the "Balich" blog, make sure to keep this source http://balich.blog.51cto.com/6641781/1710974
CentOS 6.7 Configuring the resin of the JSP operating environment