문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top