简体   繁体   中英

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. 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'. I attempted to make the following change in our sites-available folder as shown below, but it results in a redirect loop:

<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

Listen 443

at the top of the file.

Finally restart Apache in a terminal:

sudo /etc/init.d/apache2 restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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