On 03/05/2021 12:34, Eric Covener wrote:
I have configured logging in both VH's but requests are appearing in mySSL log and not the (different) localhost (http) log. I think I might be missing something fundamental here about the way localhost is treated?Can you paste the output of apachectl -S and the config for the two <virtualhosts> ? --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
sudo apachectl -S: VirtualHost configuration:[::1]:80 localhost (/etc/apache2/sites-enabled/localhost2.conf:1) 127.0.0.1:80 localhost (/etc/apache2/sites-enabled/localhost2.conf:1) *:443 mydomain.com (/etc/apache2/sites-enabled/mydomain.com-le-ssl.conf:2) *:80 mydomain.com (/etc/apache2/sites-enabled/mydomain.com.conf:4)
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 Define: MODSEC_2.5 Define: MODSEC_2.9 Define: ENABLE_USR_LIB_CGI_BIN User: name="www-data" id=33 Group: name="www-data" id=33 mydomain.com.conf: # # Virtual host for ikulpic site goodnewsbig.com # <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.example.com DocumentRoot /var/www/html/gnb ServerName mydomain.com ServerAlias www.mydomain.com ServerAdmin paul@xxxxxxxxxxxx DirectoryIndex index.php Alias /res/ /var/www/html/res/ <Directory /var/www/html/gnb> Options -Indexes AllowOverride All Require all granted </Directory> # 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 LogLevel warn ErrorLog ${APACHE_LOG_DIR}/gnb-error.log CustomLog ${APACHE_LOG_DIR}/gnb-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} =mydomain.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> mydomain.com-le-ssl.conf: <IfModule mod_ssl.c> <VirtualHost *:443># 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.example.com DocumentRoot /var/www/html/gnb ServerName mydomain.com ServerAlias www.mydomain.com ServerAdmin paul@xxxxxxxxxxxx DirectoryIndex index.php Alias /res/ /var/www/html/res/ <Directory /var/www/html/gnb> Options -Indexes AllowOverride All Require all granted </Directory> # 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 LogLevel warn ErrorLog ${APACHE_LOG_DIR}/gnb-error.log CustomLog ${APACHE_LOG_DIR}/gnb-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 # Some rewrite rules in this file were disabled on your HTTPS site, # because they have the potential to create redirection loops. # RewriteCond %{SERVER_NAME} =mydomain.com# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Include /etc/letsencrypt/options-ssl-apache.conf SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem </VirtualHost> </IfModule> localhost2.conf: <VirtualHost localhost: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.example.com ServerAdmin paul@xxxxxxxxxxxx DocumentRoot /var/www/html/gnb DirectoryIndex index.php Alias /res/ /var/www/html/res/ <Directory /var/www/html/gnb> Options -Indexes AllowOverride All Require all granted </Directory> # 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}/lh2-error.log CustomLog ${APACHE_LOG_DIR}/lh2-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 </VirtualHost> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx