我已经阅读了official documentation,将处于历史模式的VueJS路由器置于Nginx之后,并且具有以下功能:
Stackoverflow - vue-router, nginx and direct link
Stackoverflow - How to config nginx for Vue-router on Docker
查看所有这些内容并进行多次更改后,我仍然无法提供直接链接到我的路线并正确加载它们(aka,除了
-vm
C:/Program Files/Java/jre1.8.0_144/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
–launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.551.v20171108-1834
-product
com.springsource.sts.ide
–launcher.defaultAction
openFile
–launcher.XXMaxPermSize
384M
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xmn128m
-Xms256m
-Xmx768m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=384m
-XX:CompileThreshold=1000
-XX:+CMSIncrementalPacing
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
,我还能得到404)。 / p>
我正在创建一个nginx码头工人镜像(/
),并为其提供静态VueJS文件。
nginx:alpine
Nginx版本:1.16.1
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY . .
RUN npm install && npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY prod_nginx.conf /etc/nginx/nginx.confg
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
答案 0 :(得分:0)
因此,我与另一位正在工作的开发人员联系,并在他们审查设置时指出我的Dockerfile中有错别字:
COPY prod_nginx.conf /etc/nginx/nginx.confg
需要为:
COPY prod_nginx.conf /etc/nginx/nginx.conf
傻小错别字!一旦解决了这个问题,Nginx和Router就可以了!