Raspberrypi Wordpress Apache fix

not uninstall, run it:
certbot --apache

Wait there is an issue with port 80.
What does say:
apachectl -S

Hmmm? -

pi@raspberrypi:~ $ sudo certbot --apache

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apache2ctl configtest.
Action 'configtest' failed.
The Apache error log may have more information.

apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/000-default.conf: /etc/apache2/sites-enabled/000-default.conf:1: <VirtualHost> was not closed.

The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError("Error while running apache2ctl configtest.\nAction 'configtest' failed.\nThe Apache error log may have more information.\n\napache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/sites-enabled/000-default.conf: /etc/apache2/sites-enabled/000-default.conf:1: <VirtualHost> was not closed.\n")
pi@raspberrypi:~ $
pi@raspberrypi:~ $

That file needs to be closed with an:
</VirtualHost>

So, I run that first…

Your nano edit ATE the last line of the 000-default.conf file.
Go back and ensure that file ends with a line “</VirtualHost>

[nano was hungry - lol]

Damned! I think it does?



<VirtualHost *:80>
    ServerName www.davidhallows.com
    ServerAlias davidhallows.com
    ServerAlias www.davidhallows.duckdns.org
    ServerAlias davidhallows.duckdns.org
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    LogLevel info
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Alias /.well-known/acme-challenge/ /var/www/html
    Redirect / https://www.davidhallows.com
</VirtualHost>


add an extra carriage return / line feed / blank line at the end [just to be sure]
or # line
like:

<VirtualHost *:80>
    ServerName www.davidhallows.com
    ServerAlias davidhallows.com
    ServerAlias www.davidhallows.duckdns.org
    ServerAlias davidhallows.duckdns.org
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    LogLevel info
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    Alias /.well-known/acme-challenge/ /var/www/html
    Redirect / https://www.davidhallows.com
</VirtualHost>
#

I’m in! Shall I choose them all?

1 Like

Yes ALL on one cert.

WAIT
One doesn’t resolve via DNS.

So, 2 3 and 4? …

See post #34

You should add that to your DNS zone.
Same place you added the CNAME.
Oh darn, you can't CNAME the base domain - not without trashing all other entries.
Disregard the "davidhallows.com" name from the list.
Choose the other 3 names.

I can't see your screen...

ebian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov 18 16:46:56 2019
pi@raspberrypi:~ $ sudo certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: davidhallows.com
2: www.davidhallows.com
3: davidhallows.duckdns.org
4: www.davidhallows.duckdns.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel):

1 won’t work.
use 2,3,4

ok, expand?


You have an existing certificate that contains a portion of the domains you
requested (ref: /etc/letsencrypt/renewal/www.davidhallows.com.conf)

It contains these names: www.davidhallows.com, www.davidhallows.duckdns.org

You requested these names for the new certificate: www.davidhallows.com,
davidhallows.duckdns.org, www.davidhallows.duckdns.org.

Do you want to expand and replace this existing certificate with the new
certificate?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(E)xpand/(C)ancel:
1 Like

Ok, I’ve expanded it …


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):
1 Like

Presumably it’s no 2???! :slight_smile:

1 we already have a redirection statement

Done! Unfortunately my better half need my machine for a presentation gig. Worst timing!!! Thanks sooooooooooooooooooooooo mch for all yor help. I’ll catch up later :slight_smile:

1 Like

Happy wife = happy life !
[need to find a rhyme for spouse… mouse… house…]