Use WDCP official script to install Lnamp environment, installation please refer to: http://www.wdlinux.cn/bbs/thread-6292-1-1.html, this article is mainly about how to install jdk+ in Lnamp environment TOMCAT6 enables the same server to support both the PHP and the Java languages. The server system and the software versions are shown below
- [Root@e ~]# uname-a
- Linux e.centos6.4 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 00:31:26 UTC 2013 x86_64 x86_64 x86_64 gnu/linux
- [Root@e ~]#/www/wdlinux/nginx/sbin/nginx-v
- Nginx version:nginx/1.2.9
- [Root@e ~]#/www/wdlinux/httpd-2.2.24/bin/httpd-v
- Server version:apache/2.2.24 (Unix)
- Server BUILT:OCT 30 2014 00:17:07
- [Root@e ~]# rpm-qa |grep MySQL
- Mysql-libs-5.1.66-2.el6_3.x86_64
- [Root@e ~]#/www/wdlinux/php/bin/php-v
- Cannot load Zend Extension manager-it was built to configuration 1.2.0, whereas running engine is api220090626,nts
- PHP 5.3.27 (CLI) (built:oct 30 2014 00:30:02)
- Copyright (c) 1997-2013 the PHP Group
- Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
Start installing JDK: List the JDK installation packages available for the Yum Library
- [Root@e ~]# yum-y list java*
- Loaded Plugins:fastestmirror
- Loading mirror speeds from cached hostfile
- * base:mirror.bit.edu.cn
- * extras:mirror.bit.edu.cn
- * rpmforge:mirrors.neusoft.edu.cn
- * updates:mirrors.neusoft.edu.cn
- Base | 3.7 KB 00:00
- Extras | 3.3 KB 00:00
- Rpmforge | 1.9 KB 00:00
- Updates | 3.4 KB 00:00
- updates/primary_db | 171 KB 00:00
- Available Packages
- java-1.5.0-gcj.x86_64 1.5.0.0-29.1.EL6 Base
- java-1.5.0-gcj-devel.x86_64 1.5.0.0-29.1.EL6 Base
- java-1.5.0-gcj-javadoc.x86_64 1.5.0.0-29.1.EL6 Base
- java-1.5.0-gcj-src.x86_64 1.5.0.0-29.1.EL6 Base
- java-1.6.0-openjdk.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
- java-1.6.0-openjdk-demo.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
- java-1.6.0-openjdk-devel.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
- java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
- java-1.6.0-openjdk-src.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
- java-1.7.0-openjdk.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
- java-1.7.0-openjdk-demo.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
- java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
- Java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.71-2.5.3.1.el6 Updates
- java-1.7.0-openjdk-src.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
- java-1.8.0-openjdk.x86_64 1.8.0.25-1.b17.el6 Updates
- java-1.8.0-openjdk-demo.x86_64 1.8.0.25-1.b17.el6 Updates
- java-1.8.0-openjdk-devel.x86_64 1.8.0.25-1.b17.el6 Updates
- java-1.8.0-openjdk-headless.x86_64 1.8.0.25-1.b17.el6 Updates
- Java-1.8.0-openjdk-javadoc.noarch 1.8.0.25-1.b17.el6 Updates
- java-1.8.0-openjdk-src.x86_64 1.8.0.25-1.b17.el6 Updates
- java_cup.x86_64 1:0.10K-5.EL6 Base
- java_cup-javadoc.x86_64 1:0.10K-5.EL6 Base
- java_cup-manual.x86_64 1:0.10K-5.EL6 Base
- javacc.x86_64 4.1-0.5.EL6 Base
- javacc-demo.x86_64 4.1-0.5.EL6 Base
- javacc-manual.x86_64 4.1-0.5.EL6 Base
- Javassist.noarch 3.9.0-6.EL6 Base
- Javassist-javadoc.noarch 3.9.0-6.EL6 Base
Select jdk1.6 Installation
- [root@e ~]# yum-y Install java-1.6.0-openjdk*
Other versions please modify the corresponding version number of the installation to detect whether the installation was successful
- [Root@e ~]# Java-version
- Java Version "1.6.0_33"
- OpenJDK Runtime Environment (IcedTea6 1.13.5) (rhel-1.13.5.0.el6_6-x86_64)
- OpenJDK 64-bit Server VM (build 23.25-b01, Mixed mode)
Install TOMCAT6 because WDCP default port installed is 8080,tomcat default port is also 8080 in order to avoid conflicts, please change the WDCP background port to other ports (such as: 8089 ...) to manually modify the WDCP background system settings:
- [Root@e ~]# yum install Tomcat6 Tomcat6-webapps
Installation started successfully
- [Root@e ~]# Service Tomcat6 start
- Other commands: Service Tomcat6 {start|stop|restart|condrestart|try-restart|reload|force-reload|status|version}
launch success, Access test: http://ip:8080 can access that is the installation of success: Configure Nginx and Tomcat, so that it does not add the port number, directly through the domain name can also access the first increase in parsing, To point the domain name to the host IP, local can be directly changed host implementation resolution normal no 8080 port access add 8080 port access next modify Nginx and tomcat configuration so that it can access Tomcat's WebService
without a port number
- [root@e ~]# cd/www/wdlinux/nginx/conf/vhost/
- [root@e ~]# VI myweb.com.conf
- add The following content
- server {
- listen;
- server_name www.myweb.com myweb.com;
- #root/www/web/master_myweb_com/public_html;
- index index.html index.jsp index.htm;
- error_page 400/errpage/400.html;
- error_page 403/errpage/403.html;
- error_page 404/errpage/404.html;
- error_page 405/errpage/405.html;
- Location ~ \.jsp$ {
- proxy_pass http://127.0.0.1:8080;
- include naproxy.conf;
- }
- location/{
- try_files $uri @tomcat;
- }
- location @tomcat {
- proxy_pass http://127.0.0.1:8080;
- include naproxy.conf;
- }
- access_log/www/web_logs/myweb_com_access.log wwwlogs;
- Error_log/www/web_logs/myweb_com_error.log;
- }
Reload the Nginx configuration file or reboot the Nginx
- [Root@e vhost]# Service Nginxd Reload
- Nginx:the configuration file/www/wdlinux/nginx/conf/nginx.conf syntax is OK
- Nginx:configuration file/www/wdlinux/nginx/conf/nginx.conf Test is successful
No port number Access test: This nginx has successfully managed to broker a request from the myweb.com domain to port 8080 If you need to configure multiple domain names, you will also need to modify the Tomcat virtual host configuration file Default profile path:/etc/tomcat6/default project path:/var/lib/tomcat6/webapps/tomcat default point to/var/lib/tomcat6/webapps/root directory to create a new project directory. Here, copy the root project directly, and modify the
- [root@e webapps]# pwd
- /var/lib/tomcat6/webapps
- [root@e webapps]# chown-r Root Myweb.com
- To modify permissions so that new project permissions and default project permissions are consistent
- [root@e webapps]# chgrp-r Tomcat myweb.com
- [Root@e we bapps]# ll
- Total usage
- drwxrwxr-x 5 root tomcat 4096 October 22:06 examples
- drwxrwxr-x 5 Roo T tomcat 4096 October 22:06 host-manager
- drwxrwxr-x 5 root tomcat 4096 October 22:06 manager
- drwxr-x R-x 3 root tomcat 4096 October 22:48 myweb.com
- drwxrwxr-x 3 root tomcat 4096 October 22:06 root
- drwx Rwxr-x 5 root tomcat 4096 October 22:06 sample
- [root@e myweb.com]# cd myweb.com/
- [root@e myweb.com] # rm-f index.html
- [root@e myweb.com]# vi index.jsp
- write: WebService is Tomcat
- don't forget to delete root Project or to it, otherwise the new project does not take effect
- [root@e webapps]# mv Root/root. BAK
Modifying Tomcat Virtual Host configuration
- [Root@e myweb.com]# Vi/etc/tomcat6/server.xml
- After the bottom <Host></Host> tag, add the following
- <!--myweb.com host config-->
- Unpackwars= "true" autodeploy= "true"
- Xmlvalidation= "false" Xmlnamespaceaware= "false" >
- <context path= "/" reloadable= "true" docbase= "myweb.com"/>
- <Alias>myweb.com</Alias>
- <!--Singlesignon valve, share authentication between Web applications
- Documentation at:/docs/config/valve.html-->
- <!--
- <valve classname= "Org.apache.catalina.authenticator.SingleSignOn"/>
- -->
- <!--Access log processes all example.
- Documentation at:/docs/config/valve.html-->
- <!--
- <valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"
- Prefix= "Localhost_access_log." suffix= ". txt" pattern= "common" resolvehosts= "false"/>
- -->
- </Host>
Reboot tomcat, test [root@e myweb.com]# service Tomcat6 Restart success!