Heroku + Nginx构建包

时间:2018-08-06 15:04:11

标签: nginx tensorflow heroku

我试图将TensorBoard托管在Heroku实例上,并且为了保护它,我在其前面使用了Nginx-Buildpack添加了nginx。 这个想法是Tensorboard将在端口 6006 上创建应用,而Nginx会将此端口重定向到Heroku $Port提供的外部端口。

启动应用程序时,出现以下错误:

TensorBoard attempted to bind to port 6006, but it was already in use

我的配置文件如下:

Procfile

web: bin/start-nginx tensorboard --logdir="/app/" --host=http://127.0.0.1 --port=6006

config / nginx.conf.erb

daemon off;
#Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;

events {
    use epoll;
    accept_mutex on;
    worker_connections 1024;
}
http {
    gzip on;
    gzip_comp_level 2;
    gzip_min_length 512;

        server_tokens off;

        log_format l2met 'measure#nginx.service=$request_time 
        request_id=$http_x_request_id';
        access_log logs/nginx/access.log l2met;
        error_log logs/nginx/error.log;

        include mime.types;
        default_type application/octet-stream;
        sendfile on;

        #Must read the body in 5 seconds.
        client_body_timeout 5;

        #upstream app_server {
        #   server unix:/tmp/nginx.socket fail_timeout=0;
        #}

        server {
            listen <%= ENV["PORT"] %>;
            server_name http://127.0.0.1;
            keepalive_timeout 5;
            root   /app;
            port_in_redirect off;
        #index  index.html index.htm;

        location = / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_pass http://127.0.0.1:6006;
        }
    }
}

0 个答案:

没有答案