WDCP add tomcat while supporting PHP and Java Tutorials _win Server

Source: Internet
Author: User
Tags documentation tomcat zend

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

  1. [Root@e ~]# uname-a
  2. 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
  3. [Root@e ~]#/www/wdlinux/nginx/sbin/nginx-v
  4. Nginx version:nginx/1.2.9
  5. [Root@e ~]#/www/wdlinux/httpd-2.2.24/bin/httpd-v
  6. Server version:apache/2.2.24 (Unix)
  7. Server BUILT:OCT 30 2014 00:17:07
  8. [Root@e ~]# rpm-qa |grep MySQL
  9. Mysql-libs-5.1.66-2.el6_3.x86_64
  10. [Root@e ~]#/www/wdlinux/php/bin/php-v
  11. Cannot load Zend Extension manager-it was built to configuration 1.2.0, whereas running engine is api220090626,nts
  12. PHP 5.3.27 (CLI) (built:oct 30 2014 00:30:02)
  13. Copyright (c) 1997-2013 the PHP Group
  14. Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

Start installing JDK: List the JDK installation packages available for the Yum Library
  1. [Root@e ~]# yum-y list java*
  2. Loaded Plugins:fastestmirror
  3. Loading mirror speeds from cached hostfile
  4. * base:mirror.bit.edu.cn
  5. * extras:mirror.bit.edu.cn
  6. * rpmforge:mirrors.neusoft.edu.cn
  7. * updates:mirrors.neusoft.edu.cn
  8. Base | 3.7 KB 00:00
  9. Extras | 3.3 KB 00:00
  10. Rpmforge | 1.9 KB 00:00
  11. Updates | 3.4 KB 00:00
  12. updates/primary_db | 171 KB 00:00
  13. Available Packages
  14. java-1.5.0-gcj.x86_64 1.5.0.0-29.1.EL6 Base
  15. java-1.5.0-gcj-devel.x86_64 1.5.0.0-29.1.EL6 Base
  16. java-1.5.0-gcj-javadoc.x86_64 1.5.0.0-29.1.EL6 Base
  17. java-1.5.0-gcj-src.x86_64 1.5.0.0-29.1.EL6 Base
  18. java-1.6.0-openjdk.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
  19. java-1.6.0-openjdk-demo.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
  20. java-1.6.0-openjdk-devel.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
  21. java-1.6.0-openjdk-javadoc.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
  22. java-1.6.0-openjdk-src.x86_64 1:1.6.0.33-1.13.5.0.el6_6 Updates
  23. java-1.7.0-openjdk.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
  24. java-1.7.0-openjdk-demo.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
  25. java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
  26. Java-1.7.0-openjdk-javadoc.noarch 1:1.7.0.71-2.5.3.1.el6 Updates
  27. java-1.7.0-openjdk-src.x86_64 1:1.7.0.71-2.5.3.1.el6 Updates
  28. java-1.8.0-openjdk.x86_64 1.8.0.25-1.b17.el6 Updates
  29. java-1.8.0-openjdk-demo.x86_64 1.8.0.25-1.b17.el6 Updates
  30. java-1.8.0-openjdk-devel.x86_64 1.8.0.25-1.b17.el6 Updates
  31. java-1.8.0-openjdk-headless.x86_64 1.8.0.25-1.b17.el6 Updates
  32. Java-1.8.0-openjdk-javadoc.noarch 1.8.0.25-1.b17.el6 Updates
  33. java-1.8.0-openjdk-src.x86_64 1.8.0.25-1.b17.el6 Updates
  34. java_cup.x86_64 1:0.10K-5.EL6 Base
  35. java_cup-javadoc.x86_64 1:0.10K-5.EL6 Base
  36. java_cup-manual.x86_64 1:0.10K-5.EL6 Base
  37. javacc.x86_64 4.1-0.5.EL6 Base
  38. javacc-demo.x86_64 4.1-0.5.EL6 Base
  39. javacc-manual.x86_64 4.1-0.5.EL6 Base
  40. Javassist.noarch 3.9.0-6.EL6 Base
  41. Javassist-javadoc.noarch 3.9.0-6.EL6 Base
Select jdk1.6 Installation
  1. [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

  1. [Root@e ~]# Java-version
  2. Java Version "1.6.0_33"
  3. OpenJDK Runtime Environment (IcedTea6 1.13.5) (rhel-1.13.5.0.el6_6-x86_64)
  4. 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:
  1. [Root@e ~]# yum install Tomcat6 Tomcat6-webapps

Installation started successfully

  1. [Root@e ~]# Service Tomcat6 start
  2. 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

  1. [root@e ~]# cd/www/wdlinux/nginx/conf/vhost/
  2. [root@e ~]# VI myweb.com.conf
  3. add The following content
  4. server {
  5. listen;
  6. server_name www.myweb.com myweb.com;
  7. #root/www/web/master_myweb_com/public_html;
  8. index index.html index.jsp index.htm;
  9. error_page 400/errpage/400.html;
  10. error_page 403/errpage/403.html;
  11. error_page 404/errpage/404.html;
  12. error_page 405/errpage/405.html;
  13. Location ~ \.jsp$ {
  14. proxy_pass http://127.0.0.1:8080;
  15. include naproxy.conf;
  16. }
  17. location/{
  18. try_files $uri @tomcat;
  19. }
  20. location @tomcat {
  21. proxy_pass http://127.0.0.1:8080;
  22. include naproxy.conf;
  23. }
  24. access_log/www/web_logs/myweb_com_access.log wwwlogs;
  25. Error_log/www/web_logs/myweb_com_error.log;
  26. }

Reload the Nginx configuration file or reboot the Nginx

  1. [Root@e vhost]# Service Nginxd Reload
  2. Nginx:the configuration file/www/wdlinux/nginx/conf/nginx.conf syntax is OK
  3. 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

  1. [root@e webapps]# pwd
  2. /var/lib/tomcat6/webapps
  3. [root@e webapps]# chown-r Root Myweb.com
  4. To modify permissions so that new project permissions and default project permissions are consistent
  5. [root@e webapps]# chgrp-r Tomcat myweb.com
  6. [Root@e we bapps]# ll
  7. Total usage
  8. drwxrwxr-x 5 root tomcat 4096 October 22:06 examples
  9. drwxrwxr-x 5 Roo T tomcat 4096 October 22:06 host-manager
  10. drwxrwxr-x 5 root tomcat 4096 October 22:06 manager
  11. drwxr-x R-x 3 root tomcat 4096 October 22:48 myweb.com
  12. drwxrwxr-x 3 root tomcat 4096 October 22:06 root
  13. drwx Rwxr-x 5 root tomcat 4096 October 22:06 sample
  14. [root@e myweb.com]# cd myweb.com/
  15. [root@e myweb.com] # rm-f index.html
  16. [root@e myweb.com]# vi index.jsp
  17. write: WebService is Tomcat
  18. don't forget to delete root Project or to it, otherwise the new project does not take effect
  19. [root@e webapps]# mv Root/root. BAK

Modifying Tomcat Virtual Host configuration

  1. [Root@e myweb.com]# Vi/etc/tomcat6/server.xml
  2. After the bottom <Host></Host> tag, add the following
  3. <!--myweb.com host config-->
  4. Unpackwars= "true" autodeploy= "true"
  5. Xmlvalidation= "false" Xmlnamespaceaware= "false" >
  6. <context path= "/" reloadable= "true" docbase= "myweb.com"/>
  7. <Alias>myweb.com</Alias>
  8. <!--Singlesignon valve, share authentication between Web applications
  9. Documentation at:/docs/config/valve.html-->
  10. <!--
  11. <valve classname= "Org.apache.catalina.authenticator.SingleSignOn"/>
  12. -->
  13. <!--Access log processes all example.
  14. Documentation at:/docs/config/valve.html-->
  15. <!--
  16. <valve classname= "Org.apache.catalina.valves.AccessLogValve" directory= "Logs"
  17. Prefix= "Localhost_access_log." suffix= ". txt" pattern= "common" resolvehosts= "false"/>
  18. -->
  19. </Host>

Reboot tomcat, test [root@e myweb.com]# service Tomcat6 Restart success!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.