
Docker 이미지(웹 서버로 Nginx 사용)로 빌드된 AngularJs 앱(v1)이 있습니다. 아래와 같은 구조를 가지고 있습니다
-app
--build
--js
|-app.min.js
|-login.min.js
--styles
|-app.min.css
|-login.min.css
--assets
--images
--fonts
--index.html
--login.html
나는 다음을 가지고 있습니다nginx 구성
server {
listen 80;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /usr/share/nginx/html;
location /content {
rewrite ^/content$ /index.html;
}
location /content/login {
rewrite ^/content/login$ /login.html;
}
}
이것은index.html파일
<html lang="en" data-ng-app="app">
<header>
<script src="build/js/app.min.js"></script>
<link rel="stylesheet" href="build/styles/app.min.css">
</header>
<body>
...
</body>
</html>
그리고로그인.html파일
<html lang="en" data-ng-app="app-login">
<header>
<script src="build/js/login.min.js"></script>
<link rel="stylesheet" href="build/styles/login.min.css">
</header>
<body>
...
</body>
</html>
내가 이루고 싶은 것
사용자가 방문하면 http://localhost:3000/content
앱이 제공 index.html
되고 login.html
사용자가 방문하면 http://localhost:3000/content/login
.
/content
및 둘 다 /content/login
Angularjs 앱에 존재하지 않는 경로입니다.
내가 무엇을 얻었나요?
http://localhost:3000/content/login
앱에 액세스하면 다음 파일 2개가 로드됩니다.
http://localhost:3000/content/build/js/login.min.js
http://localhost:3000/content/build/styles/login.min.css
둘 다 404 오류 코드가 발생했습니다.
나는 무엇을 기대했는가
Nginx http://localhost:3000/content/build/js/login.min.js
가 http://localhost:3000/build/js/login.min.js
. CSS 파일에도 적용됩니다.