Entrance project index.html file directly in the root directory of the server access address, that is a project exclusive port
vue configured remain unchanged
nginx configuration as follows:
server { listen 8899; server_name localhost; location / { try_files $uri $uri/ /index.html; } }
The second is
Package # config-index.js modify the path configuration:
assetsPublicPath: './';
# Front-end routing configuration router.js:
const router = new VueRouter({ mode: 'history', base: '/hello', routes })
There must be a plus a base; synchronized with the project a child directory name
nginx configuration:
{Server the listen 8088; server_name xxx.com; # localhost modify the domain name for your certificate binding. LOCATION / { } LOCATION / Hello { try_files $ $ URI URI / /hello/index.html; } }
These are just for the project in the sub-directory level, 404 refresh problem to be solved