Detailed explanation of how to deploy programs on Alibaba Cloud Server and access them directly using domain names

Detailed explanation of how to deploy programs on Alibaba Cloud Server and access them directly using domain names

I had nothing to do, so I bought the cheapest Alibaba Cloud server for learning. It cost more than 300 yuan a year, which is suitable for novices to understand programs, etc.

Generally, when you buy a server, it only has a public IP address, which is something like 10.205.25.32. If you want to use a domain name (such as www.baidu.com) to directly access your website, you can buy another domain name directly in Alibaba Cloud and bind the domain name resolution to the IP address.

Some people want to know how to resolve domain names. I will add some domain name related content here.

1. Domain name:

Domain names are divided into first-level, second-level, and third-level domain names. For example, www.baidu.com, baidu is the first-level domain name, www is the second-level domain name, and this website does not have a third-level domain name.

For example, in mail.www.baidu.com, mail is a third-level domain name.

About domain name resolution:

First purchase the domain name, then enter the console

Click Parse

Then click Add Record

Select A for the record type. The host record allows you to write your own second-level or third-level domain name. Select the default resolution line. The record value is the IP you want to bind. Select 10 minutes for TTL.

Click OK to bind.

2. Server environment construction

So how do you install the environment and deploy programs on the newly purchased server? Generally, the server you buy is like a new computer. It does not contain any extra software, program environment or database, so we need to install it ourselves.

I work on Java and use MySQL database. What I am talking about here is the deployment of Java programs. First prepare jdk, mysql, tomcat, package and upload them to the server, then decompress them. If the server does not have compression software, you can download it online. Install jdk once, configure environment variables, install mysql, tomcat, and transfer your own program to the webapp in tomcat.

The preparation work is completed here. If you start tomat at this time, you can open the program by entering localhost:8080 locally, but you cannot access it using the public IP or domain name, so we have to start configuring tomcat. Open server.xml and change <Engine name="Catalina" defaultHost="localhost">,

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">Replace localhost in both items with your domain name or IP name (in fact, just write the IP, enter the domain name and automatically find the bound IP address). It is not recommended to modify the port at the beginning. The default port of tomcat is 8080. If you want to access the program on the external network, you need to enter the domain name and port number. If you do not write the port number, you must set the port in the configuration to port 80, but the domain name of port 80 must be registered, otherwise it cannot be accessed normally. Finally, add <Context path="" docBase="C:\file\apache-tomcat-7.0.70\webapps\coolsite" reloadable="false" caseSensitive="false" debug="0"></Context> in host and enter your project path in docBase. After configuration, start tomcat.

At this point you will find that the external network still cannot access your program. This is because the security group must be configured in Alibaba Cloud. Go to Alibaba Cloud Management Console -> Cloud Server ECS -> Network and Security -> Security Group. Your server list will be displayed. Click "Configure Rules" in the lower right corner of the server you want to modify to display the rule list.

We need to click "Add Security Group Rule", add the inbound direction, and add ports 8080 and 80. Now when you visit the website again, it will open smoothly. If the domain name resolution is successful, you can directly access it using the domain name plus port 8080. After the domain name registration is successful, you can directly access it using the domain name.

This concludes this article on how to deploy programs on Alibaba Cloud servers and access them directly using domain names. For more information on direct access to Alibaba Cloud using domain names, please search for previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Alibaba Cloud Server Domain Name Resolution Steps (Tutorial for Beginners)
  • Alibaba Cloud domain name and IP binding steps and methods
  • How to implement DDNS dynamic domain name resolution using Python + Alibaba Cloud
  • Detailed explanation of how to configure multiple domain names in Nginx on Alibaba Cloud Linux system
  • Alibaba Cloud Server Windows 2008 IIS Adding a Website Binding Domain Name Graphic Tutorial

<<:  Basic introductory tutorial on MySQL partition tables

>>:  Vue implements Tab tab switching

Recommend

WEB Chinese Font Application Guide

Using fonts on the Web is both a fundamental skill...

Detailed steps to install nginx on Apple M1 chip and deploy vue project

brew install nginx Apple Mac uses brew to install...

Vue implements card flip carousel display

Vue card flip carousel display, while switching d...

Detailed explanation of Nodejs array queue and forEach application

This article mainly records the problems and solu...

Detailed explanation of Nginx's rewrite module

The rewrite module is the ngx_http_rewrite_module...

Several common methods for passing additional parameters when submitting a form

When submitting a form, you may encounter situatio...

Example of building a redis-sentinel cluster based on docker

1. Overview Redis Cluster enables high availabili...

When to use table and when to use CSS (experience sharing)

The main text page of TW used to have a width of 8...

Detailed explanation of the concept of docker container layers

Table of contents 01 Container consistency 02 Con...

MySQL multi-master and one-slave data backup method tutorial

Overview Operations on any one database are autom...

Two methods to implement MySQL group counting and range aggregation

The first one: normal operation SELECT SUM(ddd) A...

Example of using javascript to drag and swap div positions

1 Implementation Principle This is done using the...

A brief discussion of 3 new features worth noting in TypeScript 3.7

Table of contents Preface Optional Chaining Nulli...