【发布时间】:2016-04-19 14:13:51
【问题描述】:
我的 Apache 2.4 配置遇到了一些问题。访问 https://subdomain.my-domain.com 总是返回这个 http 400。
Bad Request 您的浏览器发送了此服务器无法发送的请求 理解。原因:您对启用 SSL 的用户使用纯 HTTP 服务器端口。请改用 HTTPS 方案访问此 URL。
我直接通过 https 访问我的网站,因此不涉及从 http 到 https 的重定向。在我的 apache 配置下方。我知道我不检查证书的有效性。现在他们只是自签名,但将来会改变。
##################################################################
### ###
### Global Settings ###
### ###
##################################################################
DocumentRoot /var/ebc/apache2/www/htdocs
<Location /fwcheck.html>
<RequireAll>
Require all granted
</RequireAll>
</Location>
##################################################################
### ###
### Global SSL Settings ###
### ###
##################################################################
SSLProtocol ALL -SSLv2 -SSLv3
SSLProxyProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:HIGH:!MD5:!aNULL:!EDH
SSLCompression off
SSLSessionTickets off
# OCSP Stapling, only in httpd 2.3.3 and later
SSLUseStapling on
SSLStaplingResponderTimeout 5
SSLStaplingReturnResponderErrors off
SSLStaplingCache shmcb:/var/ebc/apache2/sslstaplingcache(128000)
##################################################################
### ###
### Virtual Hosts ###
### ###
##################################################################
<VirtualHost 10.173.144.43:80>
ErrorLog /var/ebc/apache2/log/error.log
CustomLog /var/ebc/apache2/log/access.log vhost_combined
##################################################################
### ###
### Send everything to https except firewall check ###
### vhost config only for port 443 necessary. ###
### No further config for port 80. ###
### ###
##################################################################
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !fwcheck.html
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
##################################################################
</VirtualHost>
<VirtualHost 10.173.144.43:443>
ServerName subdomain.my-domain.com
ErrorLog /var/ebc/apache2/log/error.log
CustomLog /var/ebc/apache2/log/access.log vhost_combined
##################################################################
### ###
### SSL Settings ###
### ###
##################################################################
RequestHeader set ClientProtocol HTTPS
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /var/ebc/apache2/ssl/subdomain.my-domain.com.crt
SSLCertificateKeyFile /var/ebc/apache2/ssl/subdomain.my-domain.com.key
SSLCACertificateFile /var/ebc/apache2/ssl/subdomain.my-domain.com.crt
ProxyRequests off
ProxyPreserveHost on
# Disable certificate checks
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
# HSTS (15768000 seconds = 6 months)
Header always set Strict-Transport-Security "max-age=15768000"
##################################################################
### ###
### Locations ###
### ###
##################################################################
DocumentRoot /var/ebc/apache2/www/htdocs/prod
<Location />
Options None
<RequireAll>
Require all granted
</RequireAll>
</Location>
<Location /web-status>
<RequireAll>
Require all denied
</RequireAll>
</Location>
<Location /balancer-manager>
<RequireAll>
Require all denied
</RequireAll>
</Location>
##################################################################
</VirtualHost>
我真的不知道为什么这不起作用。谁能给个提示?
在此先感谢大家并问候塞巴斯蒂安
【问题讨论】:
-
Stack Overflow 是一个编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参阅帮助中心的What topics can I ask about here。也许Super User 或Unix & Linux Stack Exchange 会是一个更好的提问地方。另见Where do I post questions about Dev Ops?。
-
你说得对,我不知道 Unix 和 Linux Stack Exchange。将问题移至unix.stackexchange.com/questions/256098/…。