2

node.js アプリで nginx を介して静的コンテンツをサーバーにしようとしています。一見シンプルで明白なセットアップでは、nginx 経由で静的コンテンツをルーティングできません。この行で:

  location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
                    access_log off;
                    expires max;
    }

nginx は静的コンテンツ (js、css、画像) を提供しませんが、これを削除すると、静的コンテンツが表示されます。ノード側では、express と jade を使用しています。

nginx.conf: https://gist.github.com/3331669

デフォルト: https://gist.github.com/3331674

4

3 に答える 3

2

次のことを試してください。

location ~  \.(jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
  access_log off;
  expires max;
}
于 2012-08-13T01:21:12.503 に答える
0

以下を試してください

location ~*  .*\.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html?)$ {
  access_log off;
  expires max;
}
于 2012-08-12T16:15:10.813 に答える