在我的开发服务器上,仅使用证书login(443上的HTTPS),而80上的HTTPredirect到HTTPS。 没有redirect访问不受限制,每个人都可以去任何地方,因为我不能做“要求”在HTTP上,而不是HTTPS,因为“要求”只适用于LOCATION / FILE而不是VHOST。
可以信任redirect总是拒绝访问HTTP? 它足够安全吗?
相关设置:
在位置/ var / www / html /中:
Require All granted Options Indexes FollowSymLinks
在虚拟主机[服务器IP]:80
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L]
在虚拟主机[服务器IP]:433
SSLVerifyClient require
是。 如果每个请求都被redirect,那么没有其他的东西了。 但是,您的RewriteCond %{HTTPS} off过于复杂。 HTTP VirtualHost只能有一个简单的mod_alias Redirect的一切。 当它甚至没有任何DocumentRoot它也变得更容易实现它不会提供任何内容。
<VirtualHost *:80> ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ </VirtualHost>