In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to deploy the Java project to the cloud server". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to deploy the Java project to the cloud server".
1. Purchase CVM and install system
When placing an order, I usually choose which operating system to install. I usually use both CentOS,6.x and 7.x.
Second, install pagoda panels
All servers are the same, except that different operating systems may have different commands.
1. Ssh connects to the server
The account number and password of ssh are generally set when you buy the server, and can also be changed later.
If the ssh is not available, make sure that port 22 is released.
2. Type the command for installation
Centos installation script yum install-y wget & & wget-O install.sh http://download.bt.cn/install/install_6.0.sh & & sh install.sh 8c0882dde
Ubuntu/Deepin installation script wget-O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh & & sudo bash install.sh 8c0882dde
Debian installation script wget-O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh & & bash install.sh 8c0882dde
Fedora installation script wget-O install.sh http://download.bt.cn/install/install_6.0.sh & & bash install.sh 8c0882dde
Upgrade script wget-O update.sh http://download.bt.cn/install/update.sh & & sh update.sh
3. Save the account password
It takes about two minutes to install.
Once installed, you can see a picture like this
Copy the above paragraph and save it. Inside is the backend address, login account and password, all of which can be changed.
4. Modify the security group and release the port.
In order to ensure that you can log on to the background, it will not be intercepted by the firewall.
We must release the following port 8888 8880 to find a few ports.
If you want to access the remote database 3306, you should also release it.
If you want to use the ftp tool to release 21 minutes ssh release 22
Configure HTTPS, release 443
And, of course, our Tomcat, the default port 8080 is also released.
If you use Tencent Cloud, you can set and release all ports. If you can't use Aliyun, you need to release it one by one.
3. Installation environment
The environment here refers to the project running environment, which requires at least three kinds of JDK Tomcat MySQL.
In the pagoda panel, we can install it directly.
It is recommended to install Tomcat8 (will have its own installation jdk1.8), if you install Tomcat7 (will have its own installation jdk1.7).
Then MySQL must be installed, and the version is free.
Under normal circumstances, this is fine.
Of course, if you want to make it easy to manage the database, you can download another phpmyadmin, you need to press nginx and php first, and you may eat some memory.
After Tomcat is installed, let's try to visit
The directory where Tomcat is installed is: / www/server/tomcat
Fourth, package the project and upload files
1. Use the Maven clean project
2. Run the project
3. Maven package project
4. Get the war file in the target directory
5. Upload the war file to the webapps directory of the tomcat installation directory
Fifth, visit the project
The blogger changed the port of Tomcat from 8080 to 80 before.
Access project: http://119.29.54.53/SpringMVC
Success
6. What if I can't start Tomcat or access project 404?
Unable to start Tomcat is generally due to incorrect configuration of tomcat or syntax errors, which are common in server.xml.
The project visits 404, indicating that the deployment was not successful, the project did not start successfully, and there was an error. For example, database connection error, insufficient jdk version, dependency without import, and so on.
How to troubleshoot errors if the project deployment is not successful?
It's very simple. Doesn't Tomcat have log files?
Just check it out, in the / www/server/tomcat/logs directory.
View the log of the localhost for the corresponding date.
For example, the following error is a database connection failure
This error is that Spring Data JPA requires jdk1.8, that is, java 8 (so it was recommended to install Tomcat8, which will install jdk1.8 itself)
Configure static resource mapping and domain name resolution
1. Static resource mapping
Static resource mapping should be known to everyone. It is available in tomcat's server.xml.
Indicates that you can access the items under the SpringMVC folder by accessing http://119.29.54.53
There is also the configuration of static resource mapping for the upload directory.
For example, I have an upload directory / www/uploads here, and all images uploaded by users will be saved to this uploads folder.
How do I access this directory on the server?
Can
For example, if you visit http://119.29.54.53/uploads/2017/12/ Cao Zhuo. Png, you can visit / www/uploads/2017/12/ Cao Cao. Png
2. Resolve the domain name
Ip addresses are generally difficult to remember, and sometimes it's best not to expose the public network ip.
I want to enter the domain name to access the project website, for example, enter demo.56vps.cn to access 119.29.54.53
Just add it to the domain name server
Thank you for your reading. The above is the content of "how to deploy the Java project to the CVM". After the study of this article, I believe you have a deeper understanding of how to deploy the Java project to the CVM, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.