Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy web project on Ali CVM

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How to deploy the web project on Ali CVM? When we finish writing the Node.js project locally, we need to package and upload the files to the cloud server, and other people can access and browse our programs through the url address. There are also numerous pitfalls when applying for and configuring the Aliyun ECS server. I have read a lot of articles written by great gods on the Internet, and I have also tried to collect and organize themselves. the article covers a lot of knowledge points, probably including the following aspects.

Sign up for Aliyun account

Select your login method on the home page, you can log in through Ali's third-party service.

Here I use Alipay to log in, scan the code to enter the page and click authorization.

If you do not have an Aliyun account, you can enter your member name and mobile phone number for quick registration.

Enter the personal version of the ECS Management console page after registration, and you need to carry out personal real name verification before applying.

Click the personal real name authentication link to go to the real name authentication page, and select personal real name authentication.

Recommend personal Alipay authorization verification and then go to the management console page to see that there is a CVM running.

Reset instance password

Find the reset instance password in more, and click set password.

The password is not your Aliyun account login password, jump to the page and enter your home address to complete the authentication.

The CVM access password must be composed of uppercase letters, lowercase letters, numbers and special symbols.

Restart the instance

After resetting the instance, click on the upper right corner to restart the instance.

Click OK on the pop-up page

After restarting the instance, the stopping status will be displayed, and it will take about 30 seconds to wait.

Configure security groups

Find the security group in the sidebar Network and Security, and click the configuration rules on the right.

Fill in the port range: 1Comp60000. in order to use more services, if this port range is too small, a 27017 port database like mongodb cannot be installed. The authorization object is 0.0.0.0amp 0, in order to make all ports accessible.

Click OK to save, and you can see our configured security group on the page.

Remote connection

You can use its own remote connection to connect to the server.

Click on the remote connection and the system will provide you with a password to remotely connect to your cloud server. The password appears only once and needs to be recorded when it appears.

In the remote connection, the user name is: root. Click enter to enter the previously reset instance access password (which is not displayed by default when entering the password. Click enter when you are finished).

However, it is generally not recommended to access the server in a remote connection because it will be disconnected automatically if there is no operation for more than one minute, and it is cumbersome to re-enter the remote connection password. And can not copy paste instructions in its console, can only be operated through the copy command input in the upper right corner of its window, which is troublesome.

We can access the CVM through the ssh command in the local terminal cmd.

Gitsshroot@39.96.84.220 (your public network IP)

You can find the public network IP in the configuration information of the instance

Run the View File command after a successful connection:

Cd /

Ls

Install node.js

Run the yum command to install Node.js on the CVM

Sudo yum install nodejs

After the installation is successful, run node-v to check the version number:

Install Nginx server (static server)

The specific steps come from this article:

"install Nginx under CentOS 7"

Https://www.linuxidc.com/Linu...

1. Gcc installation

To install nginx, you need to compile the source code downloaded from the official website. The compilation depends on the gcc environment. If there is no gcc environment, you need to install:

Yum install gcc-c++

Installation succeeded:

2. PCRE pcre-devel installation

PCRE (Perl Compatible Regular Expressions) is a Perl library, including a perl-compatible library of regular expressions. Nginx's http module uses pcre to parse regular expressions, so you need to install the pcre library on linux. Pcre-devel is a secondary development library developed using pcre. This library is also required for nginx. Command:

Yum install-y pcre pcre-devel

Installation succeeded:

3. Zlib installation

The zlib library provides many ways to compress and decompress. Nginx uses zlib to gzip the contents of the http package, so you need to install the zlib library on Centos.

Yum install-y zlib zlib-devel

Installation succeeded:

3. OpenSSL installation

OpenSSL is a powerful secure socket layer cipher library that includes major cryptographic algorithms, commonly used key and certificate encapsulation management functions, and SSL protocols, and provides rich applications for testing or other purposes.

Nginx supports not only the http protocol, but also https (that is, http over the ssl protocol), so you need to install the OpenSSL library on Centos.

Yum install-y openssl openssl-devel

Installation succeeded:

4. Download the nginx installation package

(1) the first method: download the .tar.gz installation package directly, nginx official website address: https://nginx.org/en/download...

(2) the second way (recommended): use wget command to download

Wget-c https://nginx.org/download/nginx-1.10.1.tar.gz

I downloaded version 1.10.1, which is the current stable version.

5. Decompression

It's still a direct order:

Tar-zxvfnginx-1.10.1.tar.gz

Cdnginx-1.10.1

6. Configuration

In the nginx-1.10.1 version, you don't need to configure anything, just use the default configuration.

. / configure

7. Compilation and installation

Make

Make install

Find the installation path:

Whereis nginx

8. Start, stop, restart nginx

Cd / usr/local/nginx/sbin/

. / nginx

Query the nginx process:

Ps aux | grep nginx

After launching successfully, you can see a page like this in the browser:

. / nginx-s stop: this method is equivalent to finding out the nginx process id and then using the kill command to force the killing of the process.

. / nginx-s quit: in this way, the stop step is to stop after the nginx process has finished processing the task.

Restart nginx

(1) the first method: stop and then start (recommended):

Restarting nginx is equivalent to stopping and then starting, that is, executing the stop command before the startup command. As follows:

. / nginx-s quit

. / nginx

(2) the second way: reload the configuration file:

When nginx's configuration file nginx.conf is modified, you need to restart nginx for the configuration to take effect. You can use-s reload to take effect in nginx without first stopping nginx and then starting nginx, as shown below:

. / nginx-s reload

9. Boot self-start

That is, add the startup code to rc.local.

Vi / etc/rc.local

Enter the letter I appears-INSERT-, press the keyboard up and down keys to control the cursor

Copy and paste the following code

/ usr/local/nginx/sbin/nginx

Press the ESC key to exit and enter the force save exit command:

: wq!

At this point, the nginx is installed, and the startup, stop, restart, and boot self-startup operations are all completed.

After reading the content of the appeal, do you have a general understanding of how to deploy the web project on Ali Cloud? If you want to know more, welcome to follow the industry information channel!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report