ポート80の純粋なTCPソケット接続をポート80のAWSのDockerコンテナにも接続しようとしています。これまでのところ:Nginx、AWS、EB、Docker、TCPソケット設定400不良リクエスト
適切なセキュリティグループを設定して、ロードバランサ上でポート80を通過させるようにします。これはHTTPではなくtcp接続に設定されています。
e2cインスタンスのnginxログを見るには、EBで作成できました。レポート次
172.31.22.8 - - [12 /月/ 2017:20:44:43 +0000] "...データ..." 400 173 " - "「 - 「
- そして、プログラムはソケットレポートの作成:
HTTP/1.1 400 Bad Request Server: nginx/1.10.1 Date: Thu, 12 Jan 2017 21:05:54 GMT Content-Type: text/html Content-Length: 173 Connection: close <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> <hr><center>nginx/1.10.1</center> </body> </html>
私はコンフィグを開始する前に、私は以下の通りであった、デフォルトでconfigurations.But 、さまざまnginxのを試してみました:
# Elastic Beanstalk Nginx Configuration File
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
log_format healthd '$msec"$uri"$status"$request_time"$upstream_response_time"$http_x_forwarded_for';
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
の/ etc /etc/nginx/nginx.conf/nginxの/ conf.d/elasticbeanstalk-nginxの-ドッキングウィンドウ-upstream.conf
upstream docker {
server 172.17.0.3:80;
keepalive 256;
}
/etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy.conf
server {
listen 80;
gzip on;
gzip_comp_level 4;
gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
set $hour $4;
}
access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;
access_log /var/log/nginx/access.log;
location/{
proxy_pass http://docker;
proxy_http_version 1.1;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
データがドッキングウィンドウを実行しているnginxのE2Cインスタンスに到達したので、私は、ロードバランサーが働いている知っています。しかし、nginxは要求をドッカーコンテナに転送しません。はい、コンテナのポート80で実行されているアプリケーションがあります。ポート80で0.0.0.0にバインドされたCソケットです。したがって、HTTTPは正しくありませんか?それはTCPですか?
私の質問は、構成ファイルは、ドッキング用のコンテナへのTCPソケット接続を転送するためのnginxのためのものですか?