Vue e-commerce project--server

buy server

That is, if we want others to access our project, then we need a server.

We used node to build the server before, which can only be accessed in the LAN.

There are many ways to purchase cloud servers: Alibaba Cloud, Tencent Cloud, etc.

Tencent Cloud Industry Smart Change · Cloud Inspires the Future- Tencent (tencent.com)

Security group and xshell operation

Open the security group to the outside world (let the server open some port numbers)

 Then log in to our server through Xshell

 XSHELL - NetSarang Website 

Use the xshell tool to log in to the server

  Then you can log in to the server

It is best to buy a Linux system when buying a server

Common operations of Linux system:

/ Root directory

cd jump directory ls view mkdir create directory pwd: view absolute path 

nginx reverse proxy

1. Why can I access our project by accessing the server ip address?

That is, we need to set some content on the server so that this ip address can access the address in the server

2. The data source of the project is http://39.98.123.211 

But the ip address of our server is different from his, we need to use nginx for this use

Detailed explanation of Nginx (one article will take you to understand Nginx) - Programmer Sought

It’s just that the server we bought for us asks for data like other servers 

Configure Nginx

nginx configuration:

1.xshell for the root directory /etc

2. Go to the etc directory, there is an Nginx directory under this directory, enter this directory [Nginx has been installed: if it has not been installed, four or five files]

3. If you want to install the Nginx server, you will find that there is an additional Nginx.conf file in the Nginx directory, and configure it in this file

4. After installing the Nginx server, you will find that there is an additional Nginx.conf file in the Nginx directory, and configure it in this file

5. Edit vim Nginx.conf, mainly add the following two items

solve the first problem

location / {

        root /root/www/dist; This is the path to put our website resources in Linux

        index        index.html;

        try_files        $url        $url/   /index.html

}

solve the second problem

location /api {

        proxy_pass http://39.98.122.111 This is the address we need to ask the server for resources

}

6. The Nginx server runs

service nginx start

Guess you like

Origin blog.csdn.net/weixin_64612659/article/details/131864029