Completeley remove everything certbot including certificates and start again

When you say 2 names do you mean floheating.co.uk and www.floheating.co.uk.

2 Likes

Interesting...
Please show the top 5 lines from these files:
/etc/apache2/sites-enabled/floheating.co.uk.conf
/etc/apache2/sites-available/floheating.co.uk.conf

2 Likes

make that 10 lines if needed
far enough to see the domain names

the picture above cutoff the first eight lines :frowning:

2 Likes

cat /etc/apache2/sites-available/floheating.co.uk.conf

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName floheating.co.uk
ServerAlias www.floheating.co.uk

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf

RewriteEngine on
RewriteCond %{SERVER_NAME} =floheating.co.uk [OR]
RewriteCond %{SERVER_NAME} =www.floheating.co.uk
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

#vim: syntax=apache ts=4 sw=4 sts=4 sr noet

<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted

cat /etc/apache2/sites-enabled/floheating.co.uk.conf

<VirtualHost *:80>
#The ServerName directive sets the request scheme, hostname and port that
#the server uses to identify itself. This is used when creating
#redirection URLs. In the context of virtual hosts, the ServerName
#specifies what hostname must appear in the request's Host: header to
#match this virtual host. For the default virtual host (this file) this
#value is not decisive as it is used as a last resort host regardless.
#However, you must set it for any further virtual host explicitly.
ServerName floheating.co.uk
ServerAlias www.floheating.co.uk

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

#Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
#error, crit, alert, emerg.
#It is also possible to configure the loglevel for particular
#modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

#For most configuration files from conf-available/, which are
#enabled or disabled at a global level, it is possible to
#include a line for only one particular virtual host. For example the
#following line enables the CGI configuration for this host only
#after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
RewriteEngine on
RewriteCond %{SERVER_NAME} =floheating.co.uk [OR]
RewriteCond %{SERVER_NAME} =www.floheating.co.uk
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

#vim: syntax=apache ts=4 sw=4 sts=4 sr noet

<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted

1 Like

They both have both names!
You must not have restarted apache :wink:
Try:
service restart apache2

3 Likes

sudo systemctl restart apache2

kes@wordpress:/etc/apache2/sites-enabled$ apachectl -S
VirtualHost configuration:
*:80 floheating.co.uk (/etc/apache2/sites-enabled/floheating.co.uk.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

2 Likes

Change this:

To:
ServerName floheating.co.uk www.floheating.co.uk

and restart apache:
systemctl restart apache2

3 Likes

as I restart apache it comes back with

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

1 Like

OK!
Change it to:
ServerAlias floheating.co.uk www.floheating.co.uk

[and restart apache]

and show again:
apachectl -S

3 Likes

done that

Now it shows the google virtual server instance

kes@wordpress:/etc/apache2/sites-available$ apachectl -S

VirtualHost configuration:
*:80 wordpress.europe-west2-c.c.direct-archery-291813.internal (/etc/apache2/sites-enabled/floheating.co.uk.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

1 Like

Man when Apache wants to play stupid it wins!
Add this line above the alias:
ServerName X
and restart and re show:
apachectl -S

3 Likes

done that and done an apache restart

kes@wordpress:/etc/apache2/sites-available$ apachectl -S
VirtualHost configuration:
*:80 X (/etc/apache2/sites-enabled/floheating.co.uk.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

1 Like

O M G !!!!!!!!!!!!!!!
This is why I hate Apache!!!!!!

2 Likes

I guess we can built it as two separate sites that do the exact same thing.
Server the same content.
Or forward one to the other.

2 Likes

is there an apache cache I can flush

1 Like

For that copy the current config to use as www
cd /etc/apache2/sites-available/
cp floheating.co.uk.conf www.floheating.co.uk.conf
then modify them so that the www says only:
ServerName www.floheating.co.uk
and the original say only:
ServerName floheating.co.uk

Enable the WWW site:
a2ensite www.floheating.co.uk.conf
restart apache
reshow:
apachectl -S

3 Likes

That would be nice - an Apache fix-all ! ! !

3 Likes

Wandering if this might be becasue previously with the forst site www and non-www both worked, and worked with ssl, and these three lines

RewriteEngine on
RewriteCond %{SERVER_NAME} =floheating.co.uk [OR]
RewriteCond %{SERVER_NAME} =www.floheating.co.uk
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

work conditionally, upon the last line being un-commented/ enabled

Has nothing to do with that :frowning:
It's just Apache being Apache!

Instead of two files (with two names in each).
We will have four files (with one name in each).

In the end it is all the same to the visitor :slight_smile:

3 Likes

done that, but after browser cache clean and web page re-load on chrome browser to www. floheating. co. uk does not show www. . just plain old floheating.co.uk

kes@wordpress:/etc/apache2/sites-enabled$ apachectl -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server floheating.co.uk (/etc/apache2/sites-enabled/floheating.co.uk.conf:1)
port 80 namevhost floheating.co.uk (/etc/apache2/sites-enabled/floheating.co.uk.conf:1)
port 80 namevhost www.floheating.co.uk (/etc/apache2/sites-enabled/www.floheating.co.uk.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex ssl-stapling: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used

1 Like