When you say 2 names do you mean floheating.co.uk and www.floheating.co.uk.
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
make that 10 lines if needed
far enough to see the domain names
the picture above cutoff the first eight lines
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.ukServerAdmin 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.ukServerAdmin 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:warnErrorLog ${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
They both have both names!
You must not have restarted apache
Try:
service restart apache2
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
Change this:
To:
ServerName floheating.co.uk www.floheating.co.uk
and restart apache:
systemctl restart apache2
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.
OK!
Change it to:
ServerAlias floheating.co.uk www.floheating.co.uk
[and restart apache]
and show again:
apachectl -S
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
Man when Apache wants to play stupid it wins!
Add this line above the alias:
ServerName X
and restart and re show:
apachectl -S
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
O M G !!!!!!!!!!!!!!!
This is why I hate Apache!!!!!!
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.
is there an apache cache I can flush
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
That would be nice - an Apache fix-all ! ! !
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
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
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