Css不适用于停靠的VueJs项目
我已经创建了一个VueJs项目并将其部署到AWS。我已经根据计划把这个项目搁置了。我刚刚添加了一行用于复制我的nginx conf文件,如下所示:Css不适用于停靠的VueJs项目,css,vue.js,nginx,Css,Vue.js,Nginx,我已经创建了一个VueJs项目并将其部署到AWS。我已经根据计划把这个项目搁置了。我刚刚添加了一行用于复制我的nginx conf文件,如下所示: # build stage FROM node:lts-alpine as build-stage WORKDIR /app COPY package*.json ./ RUN npm install COPY . . RUN npm run build # production stage FROM nginx:stable-alpine as
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY confs/nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
然后,当我检查页面url时,我意识到我的css不起作用。我还有这样一个conf文件:
# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY confs/nginx/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
我知道对于nginx的css问题有很多答案,我已经尝试了很多,但仍然找不到任何解决方案
这些是我已经尝试过的几种解决方案