
静的な angularjs ファイルを提供するための 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 が表示されます。たとえば、その 1 つは次のとおりです。
"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/
何か案が?