Separating the front and rear ends, the front end of the project how to deploy? Vue + webpack + nginx

Divided into simple steps, to be completed:

1, webpack compile the project: npm run build, to get the project - Folder dist- folder contains style files and compiled index.html

2, download and install nginx

2.1, nginx official website to download

http://nginx.org/en/download.html

2.2, unzip compressed files

2.3, start nginx, in two ways:

2.3.1, simply double-click nginx.exe, only fleeting window

2.3.2, open cmd command window, switch to the extracted directory nginx, or enter the command Start nginx.exe nginx, press Enter

2.4, the browser enter HTTP: // localhost: 80 , to see if a successful start

2.4.1 extract the directory conf / nginx.conf, you can modify the port:

3, webpack packaged static html files replace the files in the directory folder nginx

4, nginx restart the server, the modified address input port, such as: localhost: 7878

4.1 restart command 

nginx -s reload

4.2, closed nginx  

nginx -s stop (quick stop nginx) or nginx -s quit (complete and orderly stop nginx)

 

Guess you like

Origin blog.csdn.net/qq_41074373/article/details/89061702