Skip to content

Instantly share code, notes, and snippets.

@darkcolonist
Last active October 24, 2017 09:38
Show Gist options
  • Save darkcolonist/553f7e2d4a4eca9154bcfa7aebe6ca57 to your computer and use it in GitHub Desktop.
Save darkcolonist/553f7e2d4a4eca9154bcfa7aebe6ca57 to your computer and use it in GitHub Desktop.
virtual host configuration for wildcard virtual document root
<VirtualHost *>
ServerAlias *
VirtualDocumentRoot /home/nms/sites/%1/public_html
UseCanonicalName Off
<Directory "/home/nms/sites">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
ErrorLog "/home/nms/sites/error_log"
<IfModule mod_log_config.c>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %D" debug
CustomLog "/home/nms/sites/error_log" debug
</IfModule>
</VirtualHost>
[email protected] ~/sites $ ls -lahR
.:
total 44K
drwxr-xr-x 3 nms nms 4.0K Oct 24 16:26 .
drwxr-xr-x 5 nms nms 4.0K Oct 24 16:26 ..
-rw-r--r-- 1 root root 27K Oct 24 16:26 error_log
drwxr-xr-x 3 nms nms 4.0K Oct 24 11:59 sample
./sample:
total 12K
drwxr-xr-x 3 nms nms 4.0K Oct 24 11:59 .
drwxr-xr-x 3 nms nms 4.0K Oct 24 16:26 ..
drwxr-xr-x 2 nms nms 4.0K Oct 24 16:21 public_html
./sample/public_html:
total 16K
drwxr-xr-x 2 nms nms 4.0K Oct 24 16:21 .
drwxr-xr-x 3 nms nms 4.0K Oct 24 11:59 ..
-rw-r--r-- 1 nms nms 21 Oct 24 12:00 index.php
-rw-rw-r-- 1 nms nms 12 Oct 24 16:21 test.txt
find ~/sites -type d -exec chmod 755 {} \;
find ~/sites -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment