简体   繁体   English

如何在Ubuntu 10.04上将Apache 2.2.14配置为仅使用SSL(重定向循环)

[英]How to Configure Apache 2.2.14 on Ubuntu 10.04 to use SSL only (Redirect loop)

Good morning, 早上好,

I'm new to managing Apache servers. 我是管理Apache服务器的新手。 We have one internal server in particular that we would like to listen ONLY on port 443. There is only one 'site' or singular configuration on this server called 'interweb'. 特别是我们有一台内部服务器,我们只想在端口443上侦听。此服务器上只有一个“站点”或单一配置,称为“ interweb”。 I attempted to make the following change in our sites-available folder as shown below, but it results in a redirect loop: 我试图在我们的sites-available文件夹中进行以下更改,如下所示,但它导致重定向循环:

<VirtualHost *:80>
        RewriteEngine on
        ReWriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>

<VirtualHost *:443>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/htdocs (...)  

Any assistance you can offer would be greatly appreciated! 您可以提供的任何帮助将不胜感激!

You need to get rid of your first virtual host because this looks like it is your httpd.conf file, not .htaccess, then change * to your server's IP address and finally put 您需要删除第一个虚拟主机,因为它看起来像是您的httpd.conf文件,而不是.htaccess文件,然后将*更改为服务器的IP地址,最后放入

Listen 443

at the top of the file. 在文件的顶部。

Finally restart Apache in a terminal: 最后在终端中重新启动Apache:

sudo /etc/init.d/apache2 restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM