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:
|
<<: Basic introductory tutorial on MySQL partition tables
>>: Vue implements Tab tab switching
Using fonts on the Web is both a fundamental skill...
brew install nginx Apple Mac uses brew to install...
Vue card flip carousel display, while switching d...
Let's first look at the definition of the pos...
This article mainly records the problems and solu...
The rewrite module is the ngx_http_rewrite_module...
When submitting a form, you may encounter situatio...
1. Overview Redis Cluster enables high availabili...
The main text page of TW used to have a width of 8...
Table of contents 01 Container consistency 02 Con...
Overview Operations on any one database are autom...
The first one: normal operation SELECT SUM(ddd) A...
Anyone in need can refer to it. If you have tried...
1 Implementation Principle This is done using the...
Table of contents Preface Optional Chaining Nulli...