하위 디렉터리에 MEAN 스택 앱 배포

하위 디렉터리에 MEAN 스택 앱 배포

www.domain.com/nodeapp에서 노드 앱을 호스팅하려고 합니다. 나는 이미 아파치 서버에서 호스팅되는 www.domain.com 웹사이트를 가지고 있습니다. Apache 구성에서 역방향 프록시를 만들었습니다.

ProxyPass /nodeapp http://localhost:3100/nodeapp
ProxyPassReverse /nodeapp http://localhost:3100/nodeapp

이것은 MEAN 앱의 폴더 구조 아래는 dist 폴더에 내 각도 앱을 연결하는 노드 app.js 파일입니다( 을 사용하여 빌드함 ng build --prod).

app.use("/api/posts", postsRoutes);
app.use("/api/user", userRoutes);
app.use("/api/client", clientRoutes);

app.use("/", express.static(path.join(__dirname, "angular")));

app.use((req, res, next) => {
    res.sendFile(path.join(__dirname, "angular", "index.html"));
});

module.exports = app;

포트 3000에서 node server.js 파일을 실행하면 index.html만 로드되고 다른 정적 파일만 404가 발생합니다.

ng build --prod --base href정적 리소스가 포함된 앱을 올바르게 로드하는 각도 앱을 빌드하는 동안 빈 base-href를 추가하는 데 지쳤지 만 www.domain.com/nodeapp/auth/loginURL에서 직접 각도 앱을 탐색할 때 정적 파일의 경로가 www.domain.com/nodeapp/auth/login/style.css분명히 잘못된 것으로 표시됩니다. 예를 들어 ( )에 대한 API 링크는 http://localhost:3100/api/posts역방향 프록시를 사용하여 액세스할 때 작동하지 않습니다.

내가 여기서 뭘 잘못하고 있는 걸까? MEAN 앱이 아파치 서버와 함께 호스팅되는 작업 가이드가 있나요?

관련 정보