1, the configuration nginx (nginx and projects to a machine at)
When accessing the page vue, direct access to the url http server will be resolved directly into the file path, but the spa is a virtual routing, and can not directly find this file, it will be 404;
All requests need to all point to (do not know to say is not accurate) index, and then let the router js parsing url, nginx need to configure try_files $ url /index.html
(The reason for the problem, you can view HTML5 History mode: https://router.vuejs.org/zh/guide/essentials/history-mode.html#%E5%90%8E%E7%AB%AF%E9% 8D E7%%% 85% the BD the AE% E4 E5% 8B%%% the BE the AD 90% )
nginx in configuration changes:
{HTTP #front Server { the listen 80 ; server_name localhost; LOCATION / { the root / Data / ............; path item # distal index index.html; } error_page 404 500 502 503 504 / index .html; LOCATION = / index.html { the root / Data / ............ ; } } }
2, the front end may be tomcat web.xml in which the code is arranged in
<error-page> <error-code>404</error-code> <location>/</location> </error-page>
As shown below:
This way there is a downside, though resolve display problems 404, but the 404 will be captured browser to, which resulted in a pit, if your WEB project is open in the micro letter, micro-channel capture to post 404, will redirected to public page, and causing refresh the page to jump directly to the public.
3, some of the linux command
Command: su - to switch to the root, and then you will be prompted to enter the password cat nginx.conf view the file vim nginx.conf edit the file insert the key to start editing press Esc, then [the Shift +:], then [wq!] To save and Force quit --- after editing, exit view the current directory: cd ~ pwd to see nginx processes: PS -ef | grep nginx PS - EF see all process-wide format PS - AX View all processes PS -ef | grep <process name> View and screening process name associated with the process, which may be the name of the process all or part of the testing machine can access the Internet curl HTTP: // www.baidu.com see if port 80 is occupied :( monitoring state LISTEN said it had been occupied) netstat -anp | grep 80 View all current port situation already in use: netstat -nultp create nginx folder: mkdir / mnt / the Data / nginx delete a folder nginx: RM -rf / mnt / the Data / nginx decompression resource package: tar - zxvf archive name Find sbin file the Find / - iname sbin search tomcat in catalina. sh file certain content, such as: Cygwin = false grep Cygwin = false catalina.sh grep -n Cygwin = false catalina.sh (and output line number) to view the "Cygwin = false " content in a directory, which file , and the number of output lines grep -n = Cygwin to false /apache-tomcat-7.0.90/bin / * owner and group change nginx file: chown -R app: app / mnt / data / nginx given permission to read and write to the directory nginx this app users: chmod 755 / mnt / the Data / nginx dozen tar package: tar -zcvf file name + date .tar.gz file Address