Letsencrypt successfully install in ubuntu but not redirection to https

Try the rewrite code this way:

<IfModule mod_rewrite>
  #set the default action for all other requests
  <LocationMatch "^/(?!\.well-known)">
    #send all other requests to HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [L,R=301]
  </LocationMatch>
</IfModule>

OR

<IfModule mod_rewrite>
  #set the default action for all other requests
  <LocationMatch "^/(?!\.well-known)">
    #send all other requests to HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule / https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
  </LocationMatch>
</IfModule>

both options not work

I donā€™t understand why it fails.

I also canā€™t connect to the HTTPS site (even now):

curl -Iki https://3mad.in/
curl: (7) Failed to connect to 3mad.in port 443: Connection refused

HTTP yes:

curl -Iki 3mad.in
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 7969
Content-Type: text/html
Date: Fri, 14 Aug 2020 08:41:06 GMT
ETag: "1f21-5acbea5eba1c0"
Last-Modified: Thu, 13 Aug 2020 09:08:31 GMT
Server: Apache/2.4.29 (Ubuntu)
Vary: Accept-Encoding
Connection: keep-alive

so do we need to reinstall the ubuntu serve??
what you suggest?

I donā€™t know how much you have put into this system, nor how much time/effort you are willing to ā€œwasteā€.
No knowing anymore than I can assume, I would replace apache with nginx and go from there.

You could even have both installed.
[just NOT running on the same IP and port]
Example:
Apache could be moved to 81 & 444
nginx could then use 80 & 443

1 Like

ok thanks for your support. i ll do it after some time.

1 Like

Best of luck.
Cheers from Miami :beers:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.