one , Business description :

I'm working on an e-commerce project recently , There are platform side, business side and user side , So much Vue How to deploy the project to the server ?

two , deploy

(1) First, the local test project can be started and run normally .

(2) Enter in project npm run build

  A file is generated

(3) Install on server Nginx, And will admin-web Upload to server .

My upload location :

 (4) modify Nginx file , find nginx.conf

 

  three , If there are more than one vue What about the project ?

Add a few more location that will do

 

four , Finally, remember to save
:wq
five , Restart Nginx
systemctl restart nginx
 

six :Nginx.conf Content of

 
server { listen 80; server_name localhost; #charset koi8-r; #access_log
logs/host.access.log main; location / { root html/dist/; index index.html
index.htm; try_files $uri $uri/ @router; index index.html; }
# Corresponding to the above @router, The main reason is that the routing path resource is not a real path , So we can't find the specific file location @router { #
# So we need rewrite reach index.html in , Then it is handed over to the router to process the request resource rewrite ^.*$ /index.html last; }
location /admin { alias /usr/local/nginx/admin/dist; index index.html
index.htm; try_files $uri $uri/ @router; index index.html; }
# Corresponding to the above @router, The main reason is that the routing path resource is not a real path , So we can't find a specific one location @router { #
# So we need rewrite reach index.html in , Then it is handed over to the router to process the request resource try_files $uri $uri/ @router; index
index.html; } # Corresponding to the above @router, The main reason is that the routing path resource is not a real path , So it's impossible to find the details > File for location
@router { # # So we need rewrite reach index.html in , Then it is handed over to the router to process the request resource rewrite ^.*$ /index.html
last; }
 

Technology
©2020 ioDraw All rights reserved
SSM— User module ( two ) Forget the password , Change Password , Get user information One and a half years JAVA Summary of work experience python To solve the problem of dictionary writing list in Vue Common features ( Form operation ) Rare expletives in Lei Jun's press conference : this XXX I'm definitely here to make trouble !PYTHON Summary of final review 2021 Front end interview written questions and answers After the black myth Wukong Another domestic game blown up by foreigners 27 Year old invention SQL in the future , God took him away CLion Novice step on the pit :CMake project is not loaded