downloads.example.net is being ignored by my configuration. I created it as an additional virtual host to the existing hosts for file downloads. Made a folder, set permissions, set up two virtual hosts, one for HTTP to rewrite to HTTPS and the other for HTTPS. Already have a virtual host to serve people hitting the IP, I do not want to show them anything so serve a blank page on the IP, no rewards for coming directly. There is a WordPress site served on a couple of domain, same set up, rewrite to HTTPS.
Come on the IP and get the blank index.html on /var/www/html. Come on www.example.net, www.example.info, example.net and example.info and get the WordPress website. Come on downloads.example.net either on HTTP or HTTPS and get the WordPress website. I do not normally have multiple domains on virtual hosts or use rewrites to move people to SSL so wonder if I've gone wrong there.
SSL certs are shared between sites as CloudFlare add their own cert to users accessing the site.
<VirtualHost *:80>
ServerName 111.222.233.244
ServerAdmin support@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName downloads.example.net
ServerAlias downloads.example.info
ServerAdmin support@example.net
DocumentRoot /var/www/downloads
ErrorLog ${APACHE_LOG_DIR}/downloaderror.log
CustomLog ${APACHE_LOG_DIR}/downloadaccess.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName www.example.net
ServerAlias example.net
ServerAlias www.example.info
ServerAlias example.info
ServerAdmin support@example.net
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/exampleerror.log
CustomLog ${APACHE_LOG_DIR}/exampleaccess.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName 111.222.233.244
ServerAdmin support@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example.crt
SSLCertificateKeyFile /etc/apache2/ssl/example.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
<VirtualHost *:443>
ServerName downloads.example.net
ServerAlias downloads.example.info
ServerAdmin support@example.net
DocumentRoot /var/www/downloads
ErrorLog ${APACHE_LOG_DIR}/downloaderror.log
CustomLog ${APACHE_LOG_DIR}/downloadaccess.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example.crt
SSLCertificateKeyFile /etc/apache2/ssl/example.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
<VirtualHost *:443>
ServerName www.example.net
ServerAlias example.net
ServerAlias www.example.info
ServerAlias example.info
ServerAdmin support@example.net
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/exampleerror.log
CustomLog ${APACHE_LOG_DIR}/exampleaccess.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/example.crt
SSLCertificateKeyFile /etc/apache2/ssl/example.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>
EDIT:
First suggestion to add IP to first directive does nothing, the first one was not the one being served but the one with the domain in it. The second and third comment has a link to a "duplicate", the suggestions on that page are followed below.
apache2ctl -t
Syntax OK
apache2ctl -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 111.222.233.244 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost 111.222.233.244 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost downloads.example.net (/etc/apache2/sites-enabled/000-default.conf:10)
alias downloads.example.info
port 80 namevhost www.example.net (/etc/apache2/sites-enabled/000-default.conf:25)
alias example.net
alias www.example.info
alias example.info
*:443 is a NameVirtualHost
default server 111.222.233.244 (/etc/apache2/sites-enabled/000-default.conf:43)
port 443 namevhost 111.222.233.244 (/etc/apache2/sites-enabled/000-default.conf:43)
port 443 namevhost downloads.example.net (/etc/apache2/sites-enabled/000-default.conf:67)
alias downloads.example.info
port 443 namevhost www.example.net (/etc/apache2/sites-enabled/000-default.conf:93)
alias example.net
alias www.example.info
alias example.info
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/lock/apache2" mechanism=fcntl
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
Group: name="www-data" id=33
Disabled SSL and tried port 80 with only two hosts but downloads still gets sent to example.net.
<VirtualHost *:80>
ServerName downloads.example.net
ServerAdmin support@example.net
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName example.net
ServerAlias www.example.net
ServerAdmin support@example.net
DocumentRoot /var/www/wordpress
ErrorLog ${APACHE_LOG_DIR}/ufoerror.log
CustomLog ${APACHE_LOG_DIR}/ufoaccess.log combined
</VirtualHost>