我正在尝试通过 sagemaker 托管自定义 docker 容器。我正在使用 nginx、gunicorn、flask 设置。我能够为我的应用程序调用(ping)端点。我的服务的输入是“应用程序/json”格式,服务的预期输出是 json。
当我调用服务时,我在客户端得到以下输出:
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2Final//EN">\n<title>Redirecting...</title>\n<h1>Redirecting...</h1>\n<p>You should be redirected automatically to target URL: <a href="http://boaucpph.aws.local:8080/invocations/">http://boaucpph.aws.local:8080/invocations/</a>. If not click the link.'
我的端点日志告诉:
10.32.0.2 - - [28/Mar/2018:20:50:41 +0000] "POST /invocations HTTP/1.1" 301 293 "-" "AHC/2.0"
我的 nginx.conf
worker_processes 1;
daemon off; # Prevent forking
pid /tmp/nginx.pid;
error_log /var/log/nginx/error.log;
events {
# defaults
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log combined;
upstream gunicorn {
server unix:/tmp/gunicorn.sock;
}
server {
listen 8080 deferred;
client_max_body_size 100M;
keepalive_timeout 5;
location ~ ^/(ping|invocations) {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://gunicorn;
}
location / {
return 404 "{}";
}
}
}
有没有人遇到过类似的问题?对此的任何建议都会有很大帮助。