一个站点处理https请求,没有正确的ssl,其他生成\ x16 \ x03 \ x01错误

我们有两个站点,sub.example1.com和example2.com。 两者都不是专门configuration来处理SSL请求。 一个站点https:/sub.example1.com通过处理作为http请求来成功处理到端口443的安全请求。 对其他站点https://example2.com的安全请求超时并在Apache日志中logging“\ x16 \ x03 \ x01”错误。

这里是/ etc / httpd / sites-enabled /

ServerAdmin webmaster @ localhost ServerName sub.example1.com

DocumentRoot /opt/example1/web/ DirectoryIndex index.php index.html <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /opt/example/web/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all # This directive allows us to have apache2's default start page # in /apache2-default/, but still have / go to the right place #RedirectMatch ^/$ /apache2-default/ </Directory> ErrorLog /var/log/httpd/errorExample1.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/httpd/accessExample1.log combined ServerSignature On 

 ~ 

example1没有.htaccess文件。

这里是/ etc / httpd / sites-enabled /

 <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName www.example2.com DocumentRoot /opt/example2/web <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /opt/example2/web/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all # This directive allows us to have apache2's default start page # in /apache2-default/, but still have / go to the right place #RedirectMatch ^/$ /apache2-default/ </Directory> ErrorLog /var/log/httpd/errorExample2.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/httpd/accessExample2.log combined ServerSignature On 

这是example2的.htaccess

 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> 

httpd.conf文件

 UseCanonicalName Off NameVirtualHost *:80 # NameVirtualHost *:443 # Include generic snippets of statements Include conf.d/*.conf # Include the virtual host configurations: Include /etc/httpd/sites-enabled/ 

conf.d / *。conf条目:

 TraceEnable On 

serverName.conf

 ServerName ec2-xx-xx-xx-xxx.compute-1.amazonaws.com 

welcome.conf

 <LocationMatch "^/+$"> Options -Indexes ErrorDocument 403 /error/noindex.html </LocationMatch> 

我无法弄清楚为什么一个https请求转换为http,而另一个没有。 任何帮助赞赏。

两者都不是专门configuration来处理SSL请求。

在这种情况下,任何人都不应该在端口443监听,即浏览器甚至不能连接到该端口。 既然你得到了回应或者错误消息,浏览器显然能够连接到这个端口,所以显然有一些设置来处理这个端口。 但可能无法在第二台服务器上正确设置。

一个站点https:/sub.example1.com通过处理作为http请求来成功处理到端口443的安全请求。

不太可能,因为客户端正在发送HTTPS请求。 如果没有SSL(即纯HTTP),则来自客户端的SSL握手将失败,并且将不能执行内部HTTP请求。 虽然您没有提供完整的设置细节,但可能仍然是在此服务器上全局启用了SSL,或者前面有一些反向代理正在执行SSL终止并将请求作为简单的HTTP转发。

在hte apache日志中logging“\ x16 \ x03 \ x01”错误。

“\ x16 \ x03 \ x01”是SSL / TLS握手的第一个字节。 这意味着客户端正在尝试向服务器发送HTTPS,如果您使用https:// URL,则这是预期的。 很显然,服务器正在侦听客户端发送请求的端口,否则TCP连接将失败。 如果使用正常的https://host/ request,那么端口将是443,这意味着您的服务器必须被明确设置为在端口443上处理纯HTTP(这不会发生在它自己的或默认的设置中)。 或者您已经尝试了URL https://port:80/并强制浏览器使用HTTPS连接到为纯HTTP保留的端口。

我猜这个问题是在你没有在这里显示的服务器设置的一部分。

您可以将.htaccess文件添加到示例1

 RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

示例2看起来像wordpress,有httpredirect的wordpress插件 – 也许是使用它