Tencent Cloud student server to build a personal website-detailed steps to configure the web development environment

Recently, I suddenly wanted to play with the entire server. Baidu found out that Tencent Cloud student server can be played with a minimum of ten yuan a month after completing the student certification, so I bought one, and after a day of tossing, it is considered to be set up on the server. Basic web development environment (tomcat and jdk), and also ran out my first static web page on the server. The following is a detailed description of the environment construction process.

The first thing to explain is that if you want to build a good web environment on Tencent Cloud according to the following steps , the most basic requirement is to have configured jdk in the windows environment and have a certain understanding of tomcat, preferably already in the windows environment The tomcat environment has been configured under.

If there is an inappropriate description in the article, you are welcome to correct it, thank you.

table of Contents

step01 Register [Tencent Cloud](https://l.gushuji.site/tencent), purchase server

step02 Install JDK on the server

step03 Install tomcat on the server


step01 Register with Tencent Cloud and purchase a server

Baidu searches for Tencent Cloud . The first one is the official website. After entering the registration and login, you can find "Cloud + Campus" at the bottom of the official website, and then experience the version, fill in the relevant information, pay, and buy... this is not much to say (my The account has been bought, so the clicked page is different from the unpurchased page). It should be noted that the host operating system of the purchased server is recommended to choose CentOS 6.8 64-bit, which is consistent with mine. The probability of errors in the following commands is small. There are still small differences when setting up the environment between different versions. .

After the purchase is complete, click the console in the upper right corner of the Tencent Cloud official website homepage, and you can see that you have a cloud server. The orange exclamation mark here is a reminder that I should renew the fee. It should be a green circle just after the purchase. Indicates that the server is normal.

Point cloud server.

After clicking in, it should look like the picture below

Then click login, here is divided into password login and SSH secret key login. Just log in according to the password you wrote when you registered. The SSH key can be set on the left side of this page. You can check it out when you are finished.

The interface after login is shown in the figure below.

Finally, the topic is here, let's install jdk and tomcat for this server.

step02 Install JDK on the server

First check the JDK in the yum source:

yum list java*

There are many versions of JDK listed below. The JDK environment on my computer is JDK1.8, so I chose to install JDK1.8. The command is as follows:

yum install java-1.8.0-openjdk* -y

The installation needs to wait about one minute. After the installation is complete, type any of the following commands to check whether the installation is successful. This is similar to installing jdk on windows:

For example, for the java -version command, the execution result is the same as the above figure, indicating that the jdk installation is successful.

java -versionjava -c

step03 Install tomcat on the server

Tomcat is an application server, which is the first choice for developing and debugging JSP programs. It can be used to respond to requests for access to HTML pages.

First enter the local folder, we need to install tomcat in the following directory:

cd /usr/local

Then go to the official website to find the download link of Tomcat, and download it to the server. Below is a quick download address of Tomcat, copy this command to the console directly, and then press Enter:

wget https://mc.qcloudimg.com/static/archive/fa66329388f85c08e8d6c12ceb8b2ca3/apache-tomcat-7.0.77.tar.gz

Next, unzip this folder, press this command (and the following commands), there will be no messages displayed in the command line window. This is a spirit of Linux. No news is good news:

tar -zxf apache-tomcat-7.0.77.tar.gz

Rename this file: The renaming is for the convenience of subsequent operations (by typing a few words), it is not necessary.

mv apache-tomcat-7.0.77 /usr/local/tomcat7

Enter the bin folder, friends who have configured tomcat in windows should know that there are two batch files to start and stop the tomcat service under the bin folder.

cd /usr/local/tomcat7/bin

Grant permissions to all shell scripts in this folder:

chmod 777 *.sh

Start tomcat service:

./startup.sh

The screenshots of the above lines of commands are as follows:

At this point, the tomcat service on your server has been started. At this time, open the browser and visit: "your ip address: 8080" (for example, my ip is 123.207.22.175, then I will enter 123.207.22.175:8080) , If everything is normal, you should be able to see the lovely tomcat.

Let’s do the last configuration, because the http protocol accesses port 80 by default, so for convenience, we can change the access port of tomcat to 80, so that we can directly access our IP to see the tomcat page without adding the port number Up. The modification method is the same as the modification method on windows.

First, we enter the conf directory, you should be in the bin directory now, enter cd../ to return to the parent directory.

cd ../

Then enter the conf directory:

cd conf

Open the server.xml file and modify it:

vi server.xml

Move the cursor to find the position below (basically at the position where the file is about to end), what we have to do is to change this 8080 to 80. The cursor is on the character, click X to delete the current character, so hit X twice to delete "80". After deleting, press esc to build, then enter wq, save and exit the file. After that, it is best to open the file again to see if you really changed "8080" to "80".

After confirming that it is correct, we will go to the bin directory, turn off and restart tomcat. The specific operation is as shown in the figure below, which are all the commands used before.

At this point, open the browser and directly enter our IP, you can see tomcat.

Get it done!

Guess you like

Origin blog.csdn.net/NicolasLearner/article/details/112252845