SSL – 如何使http和https工作

我在专用服务器上build立了Drupal 6站点,并通过安装在其上的“Matrix”控制面板启用了SSL。

现在的问题是,该网站只从https加载页面。 大多数的图像不会加载,我想这与相同的事情有关。 理想情况下,我希望http和https都可以工作,然后我可以为需要安全的页面重新排列redirect。

尝试加载常规http页面时出现的错误是:

**Bad Request** Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. 

任何人都可以指向正确的方向吗?


编辑:

sites-enabled / domainname.co.uk中,有一个为服务器IP设置的<VirtualHost>,使用端口80,如下所示:

 <VirtualHost xx.xx.xx.xx:80> ServerName xx.co.uk ServerAlias www.xx.co.uk ServerAdmin [email protected] DocumentRoot /home/default/xx.co.uk/user/htdocs ErrorLog /home/default/xx.co.uk/user/logfiles/error_log TransferLog /home/default/xx.co.uk/user/logfiles/access_log php_admin_value open_basedir /tmp:/home/default/xx.co.uk SuexecUserGroup xx matrixdomain ScriptAlias /cgi-bin/ /home/default/xx.co.uk/user/htdocs/cgi-bin/ AddHandler server-parsed .shtml AddType text/html .shtml <Location /> Options +Includes </Location> # Begin user directives <-- # --> End user directives 

我需要为443做另外一个吗?

ports.conf中

 NameVirtualHost *:80
听80

 <IfModule mod_ssl.c>
     #基于SSL名称的虚拟主机尚不支持,因此没有
     #NameVirtualHost声明在这里
    听443
 </ IfModule>configuration

似乎你的Apache httpdconfiguration错误,并尝试在HTTP端口上服务HTTPS(看看你的Drupal站点的虚拟主机configuration),或者你正在使用像http://example.com:443/这样的scheme来访问你的Drupal的安装,这将无法正常工作。

HTTP应在端口80上提供HTTPS应在端口443上提供

您的网站应该工作在: http : //www.domain.com https://www.domain.com

这可能是几件事情之一:

我认为,总结什么是问题,让我们知道你的解决scheme!

+1使用安全页面模块(如果你还没有)

干杯

我跟随文档将帮助你

大段引用

Apache:将httpredirect到https Apache安全连接 – 强制使用HTTPS连接

让我们说你有一个叫做http://mail.chida.in&#x7684; webmail子域,并且你想把它redirect到https安全连接,例如https://mail.chida.in

这将帮助您远程保护用户的隐私和敏感信息,如用户名和密码。

那么,如何configurationApache Web服务器,以防止在没有encryption的情况下访问您的网站? 将httpredirect到https Apacheconfiguration

首先确保Apacheconfiguration为HTTPS连接,并安装必要的SSL证书。 没有非SSL访问,即只接受https连接

现在打开httpd.conf或.htaccess文件(不需要mod_rewrite):

vi httpd.conf

追加以下行:redirect永久/ https://mail.chida.in/任何请求http://mail.chida.in将转到https://mail.chida.in/

保存并closures文件。 重新启动Apache:

/etc/init.d/httpd重启

这是确保您的普通用户从不使用纯文本HTTP协议发送数据的最简单的方法。 现在,这使得嗅探敏感数据变得更加困难。 通过SSL https会话强制webmaillogin

所以如果你想让强制用户通过https访问他们的webmail,把以下configuration添加到.htaccess文件中:

RewriteEngine On RewriteCond%{HTTPS} off RewriteRule(。*) https://% {HTTP_HOST}%{REQUEST_URI}

确保在httpd.conf(mod_rewrite支持)中有如下内容:LoadModule rewrite_module modules / mod_rewrite.so

大段引用