Yes I saw that. I need to brush up on my commands to update the file but I can do that
Perhaps just use:
sudo nano /etc/apache2/sites-available/000-default.conf
sudo nano /etc/apache2/sites-available/000-default-le-ssl.conf
Yep. Your're replacing the one default line with two new lines.
With the # in front?
The line you're replacing has the # (comment mark) in front. You don't want that in front of the new lines or they won't function.
Will this work:
<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 www.innovationdrones.com
#ServerAlias www.innovationdrones.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName www.innovationdrones.com
ServerAlias www.innovationdrones.com
# 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} =innovationdrones.com [OR]
RewriteCond %{SERVER_NAME} =www.innovationdrones.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
vim: syntax=apache ts=4 sw=4 sts=4 sr noet
That shouldn't have a www.
<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 www.innovationdrones.com
#ServerAlias www.innovationdrones.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName innovationdrones.com
ServerAlias www.innovationdrones.com
# 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} =innovationdrones.com [OR]
RewriteCond %{SERVER_NAME} =www.innovationdrones.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Did you make those changes to both files?
Yes I made the changes to both files
Did you run this?
sudo apachectl -k graceful
Do I need to stop and restart apache?
The graceful command I gave you handles the apache restart cleanly without loss.
Great So the Servername will be used now?
Yep.
What's the current output of:
sudo apachectl -S
VirtualHost configuration:
*:443 innovationdrones.com (/etc/apache2/sites-enabled/000-default-le-ssl.conf:2)
*:80 innovationdrones.com (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
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
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
Did you add the ServerAlias www.innovationdrones.com
lines?
I thought they normally showed here. Hmm...
I think you did fine here.
Did you make the WordPress URL changes?
Yes looking at sudo cat /etc/apache2/sites-enabled/000-default.conf
\
# 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 www.innovationdrones.com
#ServerAlias www.innovationdrones.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName innovationdrones.com
ServerAlias www.xXinnovationdrones.com
# 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} =innovationdrones.com [OR]
RewriteCond %{SERVER_NAME} =www.innovationdrones.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
vim: syntax=apache ts=4 sw=4 sts=4 sr noet ///
Where did the ServerAlias www.xXinnovationdrones.com come from?