From: (here more detail) http://blog.csdn.net/gulu_gulu_jp/article/details/50994003
First, the preface
We've already tasted the benefits of deploying code on cloud servers, and now the main course is on the way to deploy our Javaweb project to the cloud server. be excited about it. Calm and calm down ~
II. Deployment of the project
We have a clear understanding of how Java Web projects are deployed on local machines, whether Windows or Linux, and how to deploy Java Web Projects on a cloud server. In fact, it is very simple, or can not be separated from the WEB project deployment of the three points:
JDK Environment based on ①
② a WEB server. such as Tomcat, JBoss
③ a database. such as: MySQL
The deployment of a Java Web project on a cloud server is the same as it is normally deployed under Windows and Linux. At most, you can only use the Pure command mode to operate, in fact, the process is the same.
2.1 Environment Preparation
Since it is the deployment of Java WEB projects, the first natural need to configure the relevant environment ROM. That is: First in the cloud host to build a good Java development environment, such as OpenJDK installation, TOMCAT installation, Mysql database installation.
2.2 Project Deployment
To deploy a Java Web project, we have to upload the project to the cloud server at least. In fact, the process is very simple, basically is the following three steps:
① Package Upload: Package The project into a war file and then upload it to the remote server (export the project directly to the. war file in Eclipse).
② Moves the war file under WebApps under the Tomcat directory.
③ Restart Tomcat to visit our project.
In this process, we need to be aware of. Because generally, as a Web project, we certainly have the use of the database. So what about the database section? In fact, just dump our existing database into a SQL file and upload the SQL file to the cloud server for execution. Take MySQL for example, as follows:
① dump to SQL script and upload: First locally convert the database used by our project to SQL file and upload it to the cloud server (you can use Navicat to dump the database to. sql files).
② Execute sql: Then go into MySQL and execute the SQL file. (If the server is equipped with NAVICAT, you can execute. sql file directly with Navicat, you need to select the database that holds the table before execution, should be consistent with the database name contained in the database connection statement in your code)