vhosts configuration for 443

Problems with the Windows version of XAMPP, questions, comments, and anything related.

vhosts configuration for 443

Postby userapache123 » 28. July 2021 04:28

Can you suggest the correct way to redirect to HTTPS (443) in case port 8082 is hit. The website (Mediawiki) correctly works on port 8082 as http://myserver1:8082/mywiki/index.php/Main_Page. I need to run on [port 443 (HTTPS).
I have created the certificate (crt) and key page and also done the domain name remapping on the Windows side (myserver1 correctly maps to https://wiki.my.mydomain.org/).

However, I think my redirect configuration in The following is my configuration in httpd-vhosts.conf file is incorrect. In this file, for port 8082 (where it runs as HTTP) it may not be correct, and as such, it does not redirect to 443 (for it to run as HTTPS).

The following is my configuration in httpd-vhosts.conf (and mod_SSL etc. are enabled):

Code: Select all
<VirtualHost *:8082>
   ServerName myserver1
[color=#4000FF]   # The redirect below does not work  -- Please suggest[/color]
[color=#BF0000]   Redirect /mywiki/   https://wiki.my.mydomain.org/mywiki/[/color]   
   
</VirtualHost>

<VirtualHost *:443>
  DocumentRoot "C:/Xampp/htdocs/mywiki"
   ServerName myserver1
   ServerAlias wiki.my.mydomain.org
    SSLEngine on                   
    SSLCertificateFile "C:/Xampp/Certificates/2021/wiki.my.mydomain.org.crt"
    SSLCertificateKeyFile "C:/Xampp/Certificates/2021/wiki.my.mydomain.org.key"
    <Directory "C:/Xampp/htdocs/mywiki">
        Options All
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

userapache123
 
Posts: 14
Joined: 06. May 2021 06:01
XAMPP version: xampp-windows-x64-7.4.16-0-VC1
Operating System: Windows

Re: vhosts configuration for 443

Postby Nobbie » 28. July 2021 09:12

The Redirect is correct, the DocumentRoot of the other Virtualhost is wrong, must be simply C: /xampp/htdocs instead. Ommit that mywiki at the end, that is already part of the redirected URL.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04

vhosts-http (How to block HTTP and only allow HTTPS)

Postby userapache123 » 28. July 2021 10:39

Hello Beltran,
Thanks for your reply. By removing "mywiki" and keeping only as "C:/Xampp/htdocs" I can successfully see the site working with HTTPS (443).

Now, with this current configuration the website (Mediawiki) it works both with HTTP (on port 8082) and TTPS (on port 443).

In other words, it works with HTTP with port 8082:
http://myserver1:8082/mywiki/index.php/Main_Page
And it also works with HTTPS with port 443:
https://wiki.my.mydomain.org/mywiki/index.php/Main_Page

Is there a way not the serve the web page anymore with HTTP (on port 8082) and block accessing it on HTTP, and only allow access using HTTPS (on port 443)?

How can I stop it to be accessed from HTTP and only allow it to be accessed from HTTPS?
userapache123
 
Posts: 14
Joined: 06. May 2021 06:01
XAMPP version: xampp-windows-x64-7.4.16-0-VC1
Operating System: Windows

Re: vhosts configuration for 443

Postby Nobbie » 29. July 2021 09:11

Simply dont listen to port 8082.
Or simply remove the virtualhost.
Or simply apply a different DocumentRoot.
Or simply redirect somewhere else.
Or simply issue an Error.
Tons of options.
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 132 guests