###前提・実現したいこと
初めて質問させていただきます。
dockerでnginxをインストールしたのですが、windows2010からdockerにWebでアクセスすると
エラーになりました。
ただし、teratermでdockerサーバーにログインしてcurlコマンドを実行した場合はエラーにならないです。
以下のような手順で設定を行いましたが、何か問題があるのか教えていただきませんでしょうか。
・ネットワーク
docker network create --subnet=172.18.0.0/16 br0
・docker起動
docker run --privileged -d -it --net=br0 --ip=172.18.0.21 -p 4080:80 -p 4081:81 -p 40443:443 -v/usr/local/hhvm:/var/www/html --hostname test01 --name test01 centos:latest /sbin/init
docker exec -it test01 /bin/bash
vi /etc/yum.repos.d/nginx.repo
[nginx] name=nginx repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
yum -y install nginx
mkdir /usr/local/ssl
cd /usr/local/ssl
openssl genrsa 2048 > server.key
openssl req -new -key server.key > server.csr
openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
vi /etc/nginx/nginx.conf
user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] ""$request"" ' '$status $body_bytes_sent ""$http_referer"" ' '""$http_user_agent"" ""$http_x_forwarded_for"" ' '""$request_time"" ""$upstream_response_time"" ' '""$upstream_addr""'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; keepalive_timeout 65; gzip on; gzip_types text/css text/javascript; expires 30d; open_file_cache max=100 inactive=10s; server_tokens off; add_header X-Frame-Options "SAMEORIGIN"; include /etc/nginx/conf.d/*.conf; }
vi /etc/nginx/conf.d/dashboard.conf
server { listen 80; server_name dashboard.test.jp; return 301 https://$host$request_uri; } server { listen 443 default ssl; server_name dashboard.test.jp; root /var/www/html/dashboard/public; # whatever is yours index index.hh; client_max_body_size 31M; client_body_buffer_size 32k; ssl_certificate /usr/local/ssl/server.crt; ssl_certificate_key /usr/local/ssl/server.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; expires -1; location / { #auth_basic "Basic Auth"; #auth_basic_user_file "/etc/nginx/.htpasswd"; try_files $uri $uri/ @handler; } location @handler { rewrite ^ /index.hh?/$request_uri; } location ~ ^/index.hh$ { fastcgi_pass 127.0.0.1:9001; fastcgi_index index.hh; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ \.php$ { deny all; } location ~* ^/(modules|application|system) { return 403; } location ~ .*\.(jpg|jpeg|gif|png|css|js|ico|woff|pdf|ppt|pptx|doc|docx|xls|xlsx|txt) { expires 10d; try_files $uri $uri/ @handler; } location /api/v2 { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:9001; } error_page 404 /index.hh; error_page 500 /index.hh; error_page 501 502 503 504 505 506 507 508 509 510 /error.html; # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
vi /etc/nginx/conf.d/dashboard_admin.conf
server { listen 80; server_name admin.dashboard.test.jp; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name admin.dashboard.test.jp; root /var/www/html/dashboard_admin/public; # whatever is yours index index.hh; client_max_body_size 31M; client_body_buffer_size 32k; ssl_certificate /usr/local/ssl/server.crt; ssl_certificate_key /usr/local/ssl/server.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; expires -1; location / { #auth_basic "Basic Auth"; #auth_basic_user_file "/etc/nginx/.htpasswd"; try_files $uri $uri/ @handler; } location @handler { rewrite ^ /index.hh?/$request_uri; } location ~ ^/index.hh$ { fastcgi_pass 127.0.0.1:9001; fastcgi_index index.hh; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ \.php$ { deny all; } location ~* ^/(modules|application|system) { return 403; } location ~ .*\.(jpg|jpeg|gif|png|css|js|ico|woff|pdf|ppt|pptx|doc|docx|xls|xlsx|txt) { expires 10d; try_files $uri $uri/ @handler; } location /api/v2 { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:9001; } error_page 404 /index.hh; error_page 500 /index.hh; error_page 501 502 503 504 505 506 507 508 509 510 /error.html; # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; } }
###発生している問題・エラーメッセージ
windowsPCから以下でアクセスする場合、サーバーが見つかりませんでした
というメッセージが表示されます。
teratermの場合はエラーにならないです。
なおcurlコマンドで実行すると以下のようなエラーになります。
$ curl localhost:4081
curl: (56) Recv failure: Connection was reset
回答1件
あなたの回答
tips
プレビュー