I set up Letsencrypt on my Nextcloud today. Now I can’t reach my Nextcloud anymore.
Attached is the output after creating a certificate:
Running pre-hook command: service apache2 stop
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mycloud.xxxxxx.at
http-01 challenge for nc.xxxxxx.at
Waiting for verification...
Cleaning up challenges
Running post-hook command: service apache2 start
Created an SSL vhost at /etc/apache2/sites-available/000-default-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/000-default-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/000-default-le-ssl.conf
We were unable to find a vhost with a ServerName or Address of nc.xxxxxx.at.
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: 000-default.conf | | | Enabled
2: 000-default-le-ssl.conf | mycloud.xxxxxx.at | HTTPS | Enabled
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Deploying Certificate to VirtualHost /etc/apache2/sites-available/000-default-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Added an HTTP->HTTPS rewrite in addition to other RewriteRules; you may wish to check for overall consistency.
Redirecting vhost in /etc/apache2/sites-enabled/000-default.conf to ssl vhost in /etc/apache2/sites-available/000-default-le-ssl.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://mycloud.xxxxxx.at and
https://nc.xxxxxx.at
Here my 000-default-le-ssl.conf file:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin xxxxxx.xxxxxx@xxxxxx.at
RewriteEngine On
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
ServerName mycloud.xxxxxx.at
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias nc.xxxxxx.at
SSLCertificateFile /etc/letsencrypt/live/mycloud.sptech.at/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mycloud.sptech.at/privkey.pem
</VirtualHost>
</IfModule>
Here my 000-default.conf:
<VirtualHost *:80>
ServerAdmin xxxxxx.xxxxxx@xxxxxx.at
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
RewriteCond %{SERVER_NAME} =nc.xxxxxx.at [OR]
RewriteCond %{SERVER_NAME} =mycloud.xxxxxx.at
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
Where has a mistake crept in?