
정적 Anglejs 파일을 제공하도록 nginx를 구성하는 데 문제가 있습니다.
이것이 제 상황입니다. 애플리케이션의 랜딩 페이지를 다음으로 설정하고 싶습니다.
domain.com
그리고 아래의 AngularJS 앱
domain.com/app
이제 nginx 구성에 어려움을 겪고 있습니다. 나는 다음과 같이 nginx 서버 구성을 만들었습니다.
server {
listen 80; ## listen for ipv4; this line is default and implied
index index.html index.htm;
server_name domain.com www.domain.com;
location / {
root /usr/share/nginx/html/domain.com;
}
location /app {
alias /usr/share/nginx/html/domain.com/app/public;
}
}
하지만 이것은 작동하지 않습니다. Firebug에서 다음 오류가 발생합니다.
"NetworkError: 404 Not Found - http://domain.com/app/"
어떤 아이디어?
좋습니다. 다음을 변경하면 약간의 진전이 있었습니다.
alias /usr/share/nginx/html/domain.com/app/public;
다음에:
alias /usr/share/nginx/html/domain.com/app/public/;
(별명 대신 루트를 사용하면 403 금지됨)
이제 애플리케이션에 액세스할 수 있지만 여전히 자산 파일에 404가 있습니다. 예를 들어 그 중 하나는 다음과 같습니다.
"NetworkError: 404 Not Found - http://example.com/app/assets/images/logo.png"
자산은 다음 디렉토리 아래에 있습니다.
/usr/share/nginx/html/example.com/app/public/app/assets/
하지만 어떤 이유로 nginx는 여기에서 자산을 찾고 있습니다.
/usr/share/nginx/html/example.com/app/public/assets/
어떤 생각?