admin管理员组文章数量:1122846
I am facing a issue since a few days. Any help to solve this would be awesome !
I have an angular application, that I want to host on EC2 instance. All other way are blocked by security, can't go with S3 static website.
I have a docker file to prep all:
`
### STAGE 1: Build ###
FROM node:22.5.1-alpine3.20 AS build
WORKDIR /usr/src/app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm run build
### STAGE 2: Run ###
FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/src/app/dist/front-app/browser /usr/share/nginx/html
`
and nginx.conf file :
`
http {
include /etc/nginx/mime.types;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
}
`
after runing docker:
docker
sudo docker build -t fe-app .
sudo docker run -d -p 80:80 fe-app
I reached the page but only index.html was served... I get 404 for all other static files
any idea about what could block those files to be found ? I went on the docker to check the folder /usr/share/nginx/html, all files are here
Thanks
Tried without docker, same result
Tried with apache instead of nginx, same result
Tried from files hosted on S3 bucket, same result
Working on my laptop in local from npm run start
本文标签: amazon web servicesAngularnginx on Docker and EC2 does not serve other than indexhtmlStack Overflow
版权声明:本文标题:amazon web services - Angular + nginx on Docker and EC2 does not serve other than index.html - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299567a1930495.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论