• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question How to combine http & https log files?

KDawson

New Pleskian
I want to log all access requests, whether from http (port 80) or https (port 443) to the same log file, namely

/var/www/vhosts/<mydomain.com>/statistics/logs/access_log

In other words, no separate access_ssl_log.

I have tried including a vhost.conf at the end of httpd.conf, like so:

Include "/var/www/vhosts/system/<mydomain.com>/conf/vhost.conf"

vhost.conf contains:

<IfModule mod_ssl.c>
<VirtualHost <myIP>:443 >
CustomLog /var/www/vhosts/system/<mydomain.com>/logs/access_log plesklog
</VirtualHost>
</IfModule>

After restarting Apache, https requests are still logged to access_ssl_log.

Also, I fear that the directive to include vhost.conf will get deleted the next time Plesk overwrites httpd.conf. How do I make the include permanent?
 
Thank you. But that mechanism does not seem to work. Following the instructions, I created
/usr/local/psa/admin/conf/templates/custom by cp -r from .../default. Edited one file (.../domain/
domainVirtualHost.php) and tried regenerating the config via
/usr/local/psa/admin/bin/httpdmng --reconfigure-domain <mydomain.com>. Failed: "<VirtualHost> cannot occur within <VirtualHost> section".

Backed out that one edit so that .../custom tree was identical to .../default. Rebuild failed with the same error.
 
It gets worse. Now Plesk is caching an old file (seemingly) and will not let it go.

When I log in to Plesk this message appears at the top:

"New configuration files for the Apache web server were not created due to the errors in configuration templates: AH00526: Syntax error on line 3 of /var/www/vhosts/system/<mydomain.com>/conf/vhost.conf: <VirtualHost> cannot occur within <VirtualHost> section . Detailed error descriptions were sent to you by email. Please resolve the issues and click here to generate broken configuration files once again or here to generate all configuration files. See the details in Configuration Troubleshooter"

First I deleted the <VirtualHost> from that vhost.conf file. Then I deleted vhost.conf. Then I removed every reference to vhost.conf from every file in the directory /var/www/vhosts/system/<mydomain.com>/conf. None of it matters. That same error persists.

I rebooted my machine. No good: that same error persists.

And no "detailed error descriptions" were ever emailed to me on the 5 or 6 occasions that error appeared.
 
You need to tell Plesk to rebuild the config for the bad vhost entry that you added now that your removed the bad code:

Code:
/usr/local/psa/admin/bin/httpdmng --reconfigure-domain <yourdomain.com>

Then restart Apache.
 
Back
Top