summaryrefslogtreecommitdiffstats
path: root/test/vhost.conf
blob: 266611b427080e3a51dfa490922a8642873b8f06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
LoadModule virtualvalue_module mod_virtualvalue.so

NameVirtualHost *:82
Listen *:82

<VirtualHost *:82>
  ServerName localhost

  DirectoryIndex index.php

  <Directory /var/www>
    Options ExecCGI Indexes
    AllowOverride None

    Order allow,deny
    Allow from all
  </Directory>

  # Extract Domain from the Host header
  #  Host:   192.168.34.51:82
  #  DOMAIN: 192.168.34.51
  SetEnvIfNoCase Host ^(.*)(:.*)$ DOMAIN=$1

  # Deny request if the vhost if not define there
  RewriteCond /vhosts/${ENV:DOMAIN} !-l
  RewriteRule .* - [F,E=nolog:1]

  VirtualValueEnabled On

  # Set informational fields
  VirtualValue ServerAdmin postmaster@%{ENV:DOMAIN}
  VirtualValue ServerName %{ENV:DOMAIN}

  # Set request document_root (filename)
  # And propagate to other modules (_SERVER["DOCUMENT_ROOT")
  VirtualValue DocumentRoot /var/www/%{ENV:DOMAIN}

  # Define some php variables
  VirtualValue php_admin_flag  display_errors  On
  VirtualValue php_admin_value open_basedir    "/var/tmp:/var/www/common:%{SYM:/vhosts/%{HTTP:Host}}:/var/www/%{ENV:DOMAIN}"

  # Just log the replacement request and result
  VirtualValue echo "/var/tmp:/var/www/common:%{SYM:/vhosts/%{HTTP:Host}}:/var/www/%{ENV:DOMAIN}"

  <Location />
    AuthName "Access Required"
    AuthType  Basic

    # This one need to be placed every time you need to use
    # VirtualValue AuthUserFile
    AuthUserFile /dev/null
    Require valid-user
  </Location>
  VirtualValue AuthUserFile /var/www/htpasswd-%{ENV:DOMAIN}
</VirtualHost>