Apache 2.4 Virtual hosting
Published: Wednesday, Dec 26, 2007 Last modified: Thursday, Nov 14, 2024
Include conf/extra/virtual.conf
in /usr/local/apache2/conf/httpd.conf
looks like:
$ cat conf/extra/virtual.conf
<VirtualHost YOUR_SERVER_IP:80>
UseCanonicalName Off
VirtualDocumentRoot /srv/www/%0
</VirtualHost>
Logging tips
%v
needs to capitalised unlike http://httpd.apache.org/docs/2.4/logs.html#virtualhost
LogFormat "%V %h %l %u %t \"%r\" %>s %b" comonvhost
CustomLog "|/usr/local/apache2/bin/rotatelogs -l logs/access.%Y-%m-%d 86400" comonvhost
Here is the [[Nginx “VirtualDocumentRoot” version|04055]].