サーバでlocalhost:9001
を実行しています。 localhost/supervisord
で配信しようとしています。ページが502 Bad Gateway
を返していました^~ /images
と^~ /stylesheets
場所を追加する前にNginxのスーパーバイザコンフィギュレーション
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /tmp/nginx.pid;
#daemon off;
events {
worker_connections 1024;
}
http {
# MIME/Charset
default_type application/octet-stream;
charset utf-8;
# Logging
access_log /var/log/nginx/access.log;
# Other params
server_tokens off;
tcp_nopush on;
tcp_nodelay off;
sendfile on;
upstream supervisord {
server localhost:9001;
}
server {
listen 80;
client_max_body_size 4G;
keepalive_timeout 5;
location ^~ /stylesheets {
alias /Users/ocervell/.virtualenvs/ndc-v3.3/lib/python2.7/site-packages/supervisor/ui/stylesheets;
access_log off;
}
location ^~ /images {
alias /Users/ocervell/.virtualenvs/ndc-v3.3/lib/python2.7/site-packages/supervisor/ui/images;
access_log off;
}
location /supervisord {
# Set client IP/Proxy IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
# Set host header
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://supervisord/;
}
}
}
:
nginx
configが、このようなものです。
上記の設定では、localhost/supervisord
にアクセスできますが、ページにCSSがありません。
は、私は、CSS /画像がブラウザに正しくロードされている参照してください。
しかし、私は、ブラウザのコンソールにエラーメッセージが表示され、犯人であるように思わ:
localhost/stylesheets/supervisor.css
のブラウザのMIMEタイプは、text/css
の代わりにoctet-stream
と表示されます。
ブラウザのMIMEタイプがlocalhost:9001/stylesheets/supervisor.css
の場合は、正しいtext/css
と表示されます。
このエラーを修正するにはどうすればよいですか?
静的ファイルのMIMEタイプを動的に書き換えることを考えましたが、私はnginx
のエキスパートではなく、nginx
の設定方法はわかりません。