【发布时间】:2021-04-19 10:24:53
【问题描述】:
这是对Turn off https in Docker 的跟进,提供更多信息。我还没弄明白。
我在 Docker slack 小组中询问过,他们确信它来自 nginx 或 traefik 配置。
在 Firefox 中存在 SSL_ERROR_UNRECOGNIZED_NAME_ALERT 错误,在 Chrome 中是类似的 ERR_SSL_UNRECOGNIZED_NAME_ALERT。我没有通过搜索找到太多关于其中任何一个的信息。
我的 nginx 配置:
user nginx;
daemon off;
worker_processes auto;
error_log /proc/self/fd/2 debug;
events {
worker_connections 1024;
multi_accept on;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
fastcgi_buffers 16 32k;
fastcgi_buffer_size 32k;
fastcgi_intercept_errors on;
fastcgi_read_timeout 900;
include fastcgi_params;
access_log /proc/self/fd/1;
port_in_redirect off;
send_timeout 600;
sendfile on;
client_body_timeout 600;
client_header_timeout 600;
client_max_body_size 256M;
client_body_buffer_size 16K;
client_header_buffer_size 4K;
large_client_header_buffers 8 16K;
keepalive_timeout 60;
keepalive_requests 100;
reset_timedout_connection off;
tcp_nodelay on;
tcp_nopush on;
server_tokens off;
upload_progress uploads 1m;
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 2;
gzip_http_version 1.1;
gzip_min_length 20;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/vnd.ms-fonto
gzip_vary on;
gzip_proxied any;
gzip_disable msie6;
add_header X-XSS-Protection '1; mode=block';
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
map $http_x_forwarded_proto $fastcgi_https {
default $https;
http '';
https on;
}
map $uri $no_slash_uri {
~^/(?<no_slash>.*)$ $no_slash;
}
upstream backend {
server php:9000;
}
include conf.d/*.conf;
}
我的 nginx.conf.default:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
我的 docker-compose.yml 与上一个问题没有变化。
我一直在寻找类似 traefik 配置的东西,但找不到任何东西。
到目前为止我尝试过的事情:
- 在
map $http_x_forwarded_proto $fastcgi_https内交换东西,即default $http; http on; https ''; - 删除整个地图块
- 删除 docker-compose.yml 第 140 行对 https 的引用
- 从 docker-compose.yml 中删除第 143 行
- 从 docker-compose.yml 中删除第 147 行
- 为 localhost 创建自签名证书
- 麻布和骨灰
我真的很茫然,感谢任何帮助。
【问题讨论】:
-
从上一篇的日志来看,redirect来自
index.php。如果是nginx或traefik,则请求不会到达PHP 服务,即您不会在日志中看到这一行:php_1 | 172.29.0.8 - 13/Apr/2021:14:51:24 +0000 "GET /index.php" 301 -
那么您在使用您在此处发布的简单 Nginx 配置(HTTP 到 HTTPS)时遇到问题,只有 index.html 和 HTTP 服务器?您可以在这种情况下粘贴日志吗,就像您之前的帖子中涉及 PHP 一样?你想要的是禁用 HTTPS,所以只在你的本地主机上使用 HTTP 对吗?
-
如果您可以通过本地签名证书与 https 一起使用,您是否接受答案?如果是这样,我可以发布答案
-
创建minimal, complete, and verifiable example 时发生了什么? :-) 作为追踪问题的第一步,似乎有很大的简化空间。重定向似乎来自 nginx 或 PHP,我猜可能是 Drupal (?) 将 http 重定向到 https?
index.php是什么样的?如果您添加纯文本index.html,您可以访问它吗?行政请求 - 请不要创建重复的问题。现在这个有赏金你应该关闭第一个并从这里复制所有信息。 -
对不起,伙计们,应该提到这是 Drupal,而不是普通的 HTML 页面。