I. The first method (live-server)

1. Installation method:

Npm install: Npm install -g live-server

Then, in your project directory, open the command line tool, type live-server, and press Enter (note that index.html is enabled by default). Default address: 127.0.0.1:8080

Specified port: live-server –port 9000

Install in Vscode: search the Live Server plug-in in the extension, install it, open the project, there is a go Live button in the lower right corner, click to open the project release address, the default address is 127.0.0.1:5500

Specified port: open vscode Settings file Settings. Json, and then set “liveServer. Settings. The port” : 5501 (liveServer. Settings. The proxy can set the proxy)

2. Advantages and disadvantages of Live Server

Advantages: Real-time update, hot update.

Disadvantages: because it is hot update, so unstable, it is easy to refresh their own pages.

So use this release when debugging. You don’t want to use that in your demo.

Second, the second method (IIS server)

1. Installation method:

Open the Control panel of Windows, open the on or off Windows function under programs and Functions, and check the content in the red box in the picture below. (Different Windows versions may differ, my system is Win7 Professional edition)



Then turn off the Windows Firewall (otherwise only you can access the programs you distribute, and no one else can).

After the configuration is complete, restart the computer for the configuration to take effect.

2. Release:

Open IIS Manager in Admin Tools and click Add Site. In the Add Web site dialog box, enter the name of the web site, select the physical path and port, other defaults, then determine the physical path, select the folder to store the published file system, and select ports other than 80



The default open file is index.html, you can set it yourself.

Third method (nginx server)

Download the nginx installation package:

Download: nginx.org/en/download… Click Stable Version to download the stable version and decompress it.



2, Nginx website configuration:

Copy the directory of the site you want to publish into the HTML folder under the nginx folder. Then go to the conf folder to open the nginx.conf file and configure as follows:

server {

listen 8180;

server_name localhost;

location /{

root html/share;

index index.html index.htm;

}

}

Note that the default port 80 of nginx cannot be used. If it is used, change the configuration or change the previously published port 80 to another port

Nginx startup:

You can also run the nginx command to start nginx by clicking the nginx.exe program in the nginx decompression package. You can also run the nginx command to start nginx by opening the command window in the current directory.

If the configuration of nginx.conf is modified, you need to restart nginx

Nginx – s reload