Aliyun server tomcat build and domain binding

Source: Internet
Author: User
Tags aliases zip purchase domain name java web server port tomcat tomcat server aliyun

1.Tomcat Introduction:

Tomcat server is a free open source Web application Server, a lightweight application server, is the first choice to develop and debug jsp/servlet programs.

2. Install JDK Environment

Tomcat is based on the Java environment, so you need to install the Java environment first.

Download JDK8 installation package: jdk-8u60-linux-x64.tar.gz; This is the Linux system installation package;

Can download my share of the link: Baidu Cloud link;

Install JDK8 steps: All the steps of the Souls:


1. Copy files to cloud server

sudo scp-r/home/peace/jdk-8u60-linux-x64.tar.gz root@115.29.52.140:/root/

2 Landing Cloud Server:

# #创建文件夹, and press documents

$ MKDIR/USR/LIB/JVM

$ MV jdk-8u60-linux-x64.tar.gz/usr/lib/jvm/

$ cd/usr/lib/jvm/

$ TAR-ZXVF jdk-8u60-linux-x64.tar.gz

$ rm./jdk-8u60-linux-x64.tar.gz

$MVJDK -8u60 Jdk8

# #配置环境变量:

$vi/etc/environment

Modify path in environment, append JDK path, add classpath and Java_home as follows:

Export JAVA_HOME=/USR/LIB/JVM/JDK8

Export JRE_HOME=${JAVA_HOME}/JRE

Export Classpath=.:${java_home}/lib:${jre_home}/lib

Path= "/usr/lib/jvm/jdk8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local /games "

# #告诉系统, we use the sun's JDK, not the OPENJDK:

$update-alternatives--install/usr/bin/java Java/usr/lib/jvm/jdk8/bin/java 300

$update-alternatives--install/usr/bin/javac Javac/usr/lib/jvm/jdk8/bin/javac 300

$update-alternatives--config Java

# #测试一下运行 Java-version

You can see the version number:

Java Version "1.8.0_60"

Java (TM) SE Runtime Environment (build 1.8.0_60-b27)

Java HotSpot (TM) 64-bit Server VM (build 25.60-b23, Mixed mode)


3. Install Tomcat

Download Tomcat's installation package: apache-tomcat-7.0.64.tar.gz

Can download the link I share: csdn;

The installation step is to copy to the cloud server for decompression on the line:

1. Copy files to cloud server

sudo scp-r/home/peace/apache-tomcat-7.0.64.tar.gz Root@115.29.52.140:/root/peace/java

2 Landing Cloud Server:

# #解压:

$ TAR-ZXVF apache-tomcat-7.0.64.tar.gz

# #安装完成可以测试了:

#启动:

$ cd/home/peace/java/apache-tomcat-7.0.64/bin

$./startup.sh

The environment is completed, you can access to their own website through IP:


4. Deploy your website to tomcat:

The simplest deployment:

Copy your Web site files to: Apache-tomcat-7.0.64/webapps. If your site contains dynamic engineering, you must restart Tomcat, if you are only static files (such as HTML, etc.) directly via IP access on the line;

Access mode: http://ip:8080/folder name/file. html;

Another article on how to deploy a website to Tocmact can watch my site:

It's an introduction, but it's just a copy of your project.

5. Bind your website to your server: domain name resolution

Purchase domain name, recommend to million net purchase: Link

For example, I purchased the domain name: rong0o.com.

Domain Name resolution:

Domain name resolution is the URL you purchased, pointing to your server's IP.

1. Login: Domain name management control platform: link


2. Click on the right side of the resolution to enter the following figure:


3. Click to enter advanced settings and then add a resolution: which IP fill your public network IP


Click Save on the line. Now you can access it by: domain name.

rong0o.com:8080

It is to be noted that

Now the national law requires that the domain name can be resolved after the normal access to your server. Need to record the site.

Good luck may be directly accessible

I began to be able to visit, a day after the notice of the record.

Ha ha, or all the record it.

Domain Name resolution type: See the following figure:


All right, tomcat. Environment and Domain name resolution completed.


How to deploy multiple tomcat on a Aliyun server

Pre-Deployment preparation:

1, to Aliyun official website to buy a server

2, to Aliyun server hanging disk, Aliyun have a tutorial here do not explain, see for yourself.

Linux System Mount Data disk
Video: Linux Server mount data disk

3. Download Tomcat Http://apache.arvixe.com/tomcat/tomcat-7/v7.0.54/bin/apache-tomcat-7.0.54.zip

4. Prepare three Java Web projects,

Web-home Official Website Project

Web-api Interface Project

Web-admin Management Background Project



To start configuring the environment:

1, log in the successful application of the Aliyun server

2, edit. bashrc file

Vim. BASHRC

The default content in the file is

#. BASHRC

# User specific aliases and functions

Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' Mv-i '

#ource Global Definitions
if [-F/ETC/BASHRC]; Then
. /etc/bashrc
Fi

3. Add Tomcat Environment variables

#. BASHRC

# User specific aliases and functions

Alias rm= ' Rm-i '
Alias cp= ' Cp-i '
Alias mv= ' Mv-i '


catalina_1_base=/alidata/server/tomcat-web-admin-6011
catalina_1_home=/alidata/server/tomcat-web-admin-6011
Catalina_1_tmpdir=/alidata/server/tomcat-yunmai-admin-8011/temp
Export Catalina_1_base catalina_1_home Catalina_1_tmpdir

catalina_2_base=/alidata/server/tomcat-web-home-6022
catalina_2_home=/alidata/server/tomcat-web-home-6022
Catalina_2_tmpdir=/alidata/server/tomcat-web-home-6022/temp
Export Catalina_2_base catalina_2_home Catalina_2_tmpdir

catalina_3_base=/alidata/server/tomcat-web-api-6033
catalina_3_home=/alidata/server/tomcat-web-api-6033
Catalina_3_tmpdir=/alidata/server/tomcat-web-6033/temp
Export Catalina_3_base catalina_3_home Catalina_3_tmpdir



#ource Global Definitions
if [-F/ETC/BASHRC]; Then
. /etc/bashrc
Fi

4, restart the server reboot

Reboot

  

To Configure the Tomact service:

1, the download down the Apache-tomcat-7.0.54.zip complex 3, renamed

Tomcat-web-admin-6011.zip

Tomcat-web-home-6022.zip

Tomcat-web-api-6033.zip<br> <strong>2, put the newly renamed three Tomcat on the last to Ali server </strong><br> Cd/alidat a/server/<br> This decompression file

Unzip Tomcat-web-admin-6011.zip
Unzip Tomcat-web-home-6022.zip
Unzip Tomcat-web-api-6033.zip

<strong>3, modify tomcat-web-admin-6011 configuration </strong> <br> <strong> modify file Conf\server.xml file </ Strong><br>

Cd/alidata/server/tomcat-web-admin-6011/conf


Vim Server.xml

Find configuration <server port= "8005" shutdown= "Shutdown" >
Modified into <server port= "16011" shutdown= "Shutdown" >

Locate the configuration <connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>
Modified to <connector port= "6011" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>

Locate the configuration <connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
Modified into <connector port= "6110" protocol= "ajp/1.3" redirectport= "8443"/>

Add the following code to the <Host> </Host> to configure the Web Project Access path <br><context path= "" docbase= "/alidata/www/web-admin"/ >

<strong> Modify bin\catalina.sh file </strong>

Cd/alidata/server/tomcat-web-admin-6011/bin
Vim catalina.sh
Replace the configuration
Catalina_base Modify replace called Catalina_1_base
Catalina_home Modify replace called Catalina_1_home
Catalina_tmpdir Modify replace called Catalina_1_tmpdir

<strong>4, modify tomcat-web-home-6022 configuration <br></strong> <strong> Modify file Conf\server.xml file </ Strong>

Cd/alidata/server/tomcat-web-home-6022/conf
Vim Server.xml

Find configuration <server port= "8005" shutdown= "Shutdown" >
Modified into <server port= "16022" shutdown= "Shutdown" >

Locate the configuration <connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>
Modified to <connector port= "6022" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>

Locate the configuration <connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
Modified into <connector port= "6220" protocol= "ajp/1.3" redirectport= "8443"/>

Add the following code to the <Host> </Host> to configure the Web Project Access path <br><context path= "" docbase= "/alidata/www/web-home"/>

<strong> Modify bin\catalina.sh file </strong>

Cd/alidata/server/tomcat-web-home-6022/bin
Vim catalina.sh
Replace the configuration
Catalina_base Modify replace called Catalina_2_base
Catalina_home Modify replace called Catalina_2_home
Catalina_tmpdir Modify replace called Catalina_2_tmpdir

<strong>5, modify tomcat-web-api-6033 configuration <br></strong> <strong> Modify Files Conf\server.xml</strong >

Cd/alidata/server/tomcat-web-api-6033/conf
Vim Server.xml

Find configuration <server port= "8005" shutdown= "Shutdown" >
Modified into <server port= "16033" shutdown= "Shutdown" >

Locate the configuration <connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>
Modified to <connector port= "6033" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>

Locate the configuration <connector port= "8009" protocol= "ajp/1.3" redirectport= "8443"/>
Modified into <connector port= "6330" protocol= "ajp/1.3" redirectport= "8443"/><br><br><span> in
<em> </em><strong> Modify bin\catalina.sh file </strong><em><br></em>

Cd/alidata/server/tomcat-web-api-6033/bin
Vim catalina.sh
Replace the configuration
Catalina_base Modify replace called Catalina_3_base
Catalina_home Modify replace called Catalina_3_home
Catalina_tmpdir Modify replace called Catalina_3_tmpdir

  

To Configure a Web project:

1, create Java Web project Web-admin to the server

cd/alidata/www/

Upload Web-admin.zip Decompression Unzip Web-admin.zip

2, create Java Web project Web-home to the server

cd/alidata/www/

Upload Web-home.zip Decompression Unzip Web-home.zip

3, create Java Web project Web-api to the server

cd/alidata/www/

Upload Web-api.zip Decompression Unzip Web-api.zip


start Tocamt Web server, test validation:

Cd/alidata/server/tomcat-web-admin-6011/bin

Start server: SH startup.sh

Test Validation: Browser scope web-admin Web site project http://IP:6011/(purchase Aliyun server IP address)

Stop server: SH shutdown.sh



Cd/alidata/server/tomcat-web-home-6022/bin

Start server: SH startup.sh

Test Validation: Browser scope web-home Web site project http://IP:6022/(purchase Aliyun server IP address)

Stop server: SH shutdown.sh





Cd/alidata/server/tomcat-web-api-6033/bin

Start server: SH startup.sh

Test Validation: Browser scope WEB-API Web site project http://IP:6033/(purchase Aliyun server IP address)

Stop server: SH shutdown.sh


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.