vhost.conf.master 8.89 KB
Newer Older
tbrehm's avatar
tbrehm committed
1

2
3
4
5
6
7
<Directory /var/www/{tmpl_var name='domain'}>
    AllowOverride None
    Order Deny,Allow
    Deny from all
</Directory>

tbrehm's avatar
tbrehm committed
8
<VirtualHost <tmpl_var name='ip_address'>:80>
redray's avatar
redray committed
9
<tmpl_if name='php' op='==' value='suphp'>
10
    DocumentRoot <tmpl_var name='web_document_root'>
redray's avatar
redray committed
11
</tmpl_else>
vogelor's avatar
vogelor committed
12
13
14
  <tmpl_if name='php' op='==' value='cgi'>
    DocumentRoot <tmpl_var name='web_document_root'>
  </tmpl_else>
15
    DocumentRoot <tmpl_var name='web_document_root_www'>
vogelor's avatar
vogelor committed
16
  </tmpl_if>
redray's avatar
redray committed
17
18
</tmpl_if>

19
    ServerName <tmpl_var name='domain'>
redray's avatar
redray committed
20
<tmpl_if name='alias'>
21
    ServerAlias <tmpl_var name='alias'>
redray's avatar
redray committed
22
</tmpl_if>
23
    ServerAdmin webmaster@<tmpl_var name='domain'>
redray's avatar
redray committed
24

tbrehm's avatar
tbrehm committed
25
    ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
26
<tmpl_if name='errordocs'>
redray's avatar
redray committed
27

28
29
30
31
32
33
34
    ErrorDocument 400 /error/400.html
    ErrorDocument 401 /error/401.html
    ErrorDocument 403 /error/403.html
    ErrorDocument 404 /error/404.html
    ErrorDocument 405 /error/405.html
    ErrorDocument 500 /error/500.html
    ErrorDocument 503 /error/503.html
redray's avatar
redray committed
35
</tmpl_if>
36
	
37
38
39
40
41
    <Directory {tmpl_var name='web_document_root_www'}>
        Options FollowSymLinks
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
redray's avatar
redray committed
42
<tmpl_if name='ssi' op='==' value='y'>
43
44
45
46
47
        
        # ssi enabled
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        Options +Includes
tbrehm's avatar
tbrehm committed
48
</tmpl_if>
tbrehm's avatar
tbrehm committed
49
<tmpl_if name='php' op='==' value='no'>
tbrehm's avatar
tbrehm committed
50
        <Files ~ '.php[s3-6]{0,1}$'>
tbrehm's avatar
tbrehm committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>
	<Directory {tmpl_var name='web_document_root'}>
        Options FollowSymLinks
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
<tmpl_if name='ssi' op='==' value='y'>
        
        # ssi enabled
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        Options +Includes
</tmpl_if>
tbrehm's avatar
tbrehm committed
69
<tmpl_if name='php' op='==' value='no'>
tbrehm's avatar
tbrehm committed
70
        <Files ~ '.php[s3-6]{0,1}$'>
tbrehm's avatar
tbrehm committed
71
72
73
74
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
redray's avatar
redray committed
75
</tmpl_if>
76
    </Directory>
redray's avatar
redray committed
77

78
<tmpl_if name='cgi' op='==' value='y'>
79
80
81
82
    # cgi enabled
    ScriptAlias  /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
tbrehm's avatar
tbrehm committed
83
</tmpl_if>
84
<tmpl_if name='suexec' op='==' value='y'>
85
86
    # suexec enabled
    SuexecUserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
tbrehm's avatar
tbrehm committed
87
88
</tmpl_if>
<tmpl_if name='php' op='==' value='mod'>
89
90
    # mod_php enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
tbrehm's avatar
tbrehm committed
91
92
93
94
	php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>"	
    php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp
    php_admin_value session.save_path <tmpl_var name='document_root'>/tmp
    #php_admin_value open_basedir <tmpl_var name='document_root'>:/usr/share/php5
tbrehm's avatar
tbrehm committed
95
96
</tmpl_if>
<tmpl_if name='php' op='==' value='suphp'>
97
98
99
100
101
102
103
    # suphp enabled
    <Directory {tmpl_var name='web_document_root'}>
        suPHP_Engine on
        # suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
        AddHandler x-httpd-suphp .php .php3 .php4 .php5
        suPHP_AddHandler x-httpd-suphp
    </Directory>
tbrehm's avatar
tbrehm committed
104
105
</tmpl_if>
<tmpl_if name='php' op='==' value='cgi'>
106
    # php as cgi enabled
107
    ScriptAlias /php5-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
tbrehm's avatar
tbrehm committed
108
109
    Action php5-cgi /php5-cgi
    AddHandler php5-cgi .php .php3 .php4 .php5
tbrehm's avatar
tbrehm committed
110
</tmpl_if>
daniel's avatar
daniel committed
111
<tmpl_if name='php' op='==' value='fast-cgi'>
112
113
114
115
116
117
118
119
120
    # php as fast-cgi enabled
    <Directory {tmpl_var name='web_document_root_www'}>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
        Options +ExecCGI
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
daniel's avatar
daniel committed
121
</tmpl_if>
tbrehm's avatar
tbrehm committed
122
<tmpl_if name="rewrite_enabled">
123
124
    
    RewriteEngine on
tbrehm's avatar
tbrehm committed
125
<tmpl_loop name="redirects">
126
127
    RewriteCond %{HTTP_HOST}   ^<tmpl_var name='rewrite_domain'> [NC]
    RewriteRule   ^/(.*)$ <tmpl_var name='rewrite_target'>$1  [<tmpl_var name='rewrite_type'>]
tbrehm's avatar
tbrehm committed
128
</tmpl_loop>
tbrehm's avatar
tbrehm committed
129
</tmpl_if>
130

131
<tmpl_var name='apache_directives'>
tbrehm's avatar
tbrehm committed
132
133
134
135
</VirtualHost>



tbrehm's avatar
tbrehm committed
136
137
<tmpl_if name='ssl_enabled'>
<IfModule mod_ssl.c>
tbrehm's avatar
tbrehm committed
138
139
140
141
142
###########################################################
# SSL Vhost
###########################################################

<VirtualHost <tmpl_var name='ip_address'>:443>
143
144
145
<tmpl_if name='php' op='==' value='suphp'>
    DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
vogelor's avatar
vogelor committed
146
147
148
  <tmpl_if name='php' op='==' value='cgi'>
    DocumentRoot <tmpl_var name='web_document_root'>
  </tmpl_else>
149
    DocumentRoot <tmpl_var name='web_document_root_www'>
vogelor's avatar
vogelor committed
150
  </tmpl_if>
151
152
153
</tmpl_if>

    ServerName <tmpl_var name='domain'>
redray's avatar
redray committed
154
<tmpl_if name='alias'>
155
    ServerAlias <tmpl_var name='alias'>
redray's avatar
redray committed
156
</tmpl_if>
157
158
    ServerAdmin webmaster@<tmpl_var name='domain'>
    
tbrehm's avatar
tbrehm committed
159
    ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
redray's avatar
redray committed
160

161
<tmpl_if name='errordocs'>
162
163
164
165
166
167
168
    ErrorDocument 400 /error/400.html
    ErrorDocument 401 /error/401.html
    ErrorDocument 403 /error/403.html
    ErrorDocument 404 /error/404.html
    ErrorDocument 405 /error/405.html
    ErrorDocument 500 /error/500.html
    ErrorDocument 503 /error/503.html
169
170
171
172
173

</tmpl_if>
    SSLEngine on
    SSLCertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='domain'>.crt
    SSLCertificateKeyFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='domain'>.key
tbrehm's avatar
tbrehm committed
174
<tmpl_if name='has_bundle_cert'>
175
    SSLCACertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='domain'>.bundle
tbrehm's avatar
tbrehm committed
176
</tmpl_if>
177
178
179
180
181
182
183
184
185
186
187
188
189
190
    
	<Directory {tmpl_var name='web_document_root_www'}>
        Options FollowSymLinks
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
<tmpl_if name='ssi' op='==' value='y'>
        
        # ssi enabled
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        Options +Includes
</tmpl_if>
<tmpl_if name='php' op='==' value='no'>
tbrehm's avatar
tbrehm committed
191
        <Files ~ '.php[s3-6]{0,1}$'>
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>
	<Directory {tmpl_var name='web_document_root'}>
        Options FollowSymLinks
        AllowOverride Indexes AuthConfig Limit FileInfo
        Order allow,deny
        Allow from all
<tmpl_if name='ssi' op='==' value='y'>
        
        # ssi enabled
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        Options +Includes
</tmpl_if>
<tmpl_if name='php' op='==' value='no'>
tbrehm's avatar
tbrehm committed
211
        <Files ~ '.php[s3-6]{0,1}$'>
212
213
214
215
216
217
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>
tbrehm's avatar
tbrehm committed
218

219
<tmpl_if name='cgi'op='==' value='y'>
220
221
222
223
    # cgi enabled
    ScriptAlias  /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
tbrehm's avatar
tbrehm committed
224
</tmpl_if>
225
<tmpl_if name='ssi'op='==' value='y'>
226
227
228
    # ssi enabled
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
tbrehm's avatar
tbrehm committed
229
</tmpl_if>
230
<tmpl_if name='suexec'op='==' value='y'>
231
232
    # suexec enabled
    SuexecUserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
tbrehm's avatar
tbrehm committed
233
234
</tmpl_if>
<tmpl_if name='php' op='==' value='mod'>
235
236
    # mod_php enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
tbrehm's avatar
tbrehm committed
237
238
239
240
	php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>"	
    php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp
    php_admin_value session.save_path <tmpl_var name='document_root'>/tmp
    #php_admin_value open_basedir <tmpl_var name='document_root'>:/usr/share/php5
tbrehm's avatar
tbrehm committed
241
242
</tmpl_if>
<tmpl_if name='php' op='==' value='suphp'>
243
244
    # suphp enabled
    suPHP_Engine on
245
    # suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
246
247
    AddHandler x-httpd-php .php .php3 .php4 .php5
    suPHP_AddHandler x-httpd-php
tbrehm's avatar
tbrehm committed
248
249
</tmpl_if>
<tmpl_if name='php' op='==' value='cgi'>
250
    # php as cgi enabled
251
    ScriptAlias /php5-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
tbrehm's avatar
tbrehm committed
252
253
    Action php5-cgi /php5-cgi
    AddHandler php5-cgi .php .php3 .php4 .php5
tbrehm's avatar
tbrehm committed
254
</tmpl_if>
255
<tmpl_if name='php' op='==' value='fast-cgi'>
256
257
258
259
260
261
262
263
264
    # php as fast-cgi enabled
    <Directory {tmpl_var name='web_document_root_www'}>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
        Options +ExecCGI
        AllowOverride all
        Order allow,deny
        Allow from all
    </Directory>
265
</tmpl_if>
tbrehm's avatar
tbrehm committed
266
<tmpl_if name="rewrite_enabled">
267
268
    
    RewriteEngine on
tbrehm's avatar
tbrehm committed
269
<tmpl_loop name="redirects">
270
271
272
    
    RewriteCond %{HTTP_HOST}   ^<tmpl_var name='rewrite_domain'> [NC]
    RewriteRule   ^/(.*)$ <tmpl_var name='rewrite_target'>$1  [<tmpl_var name='rewrite_type'>]
tbrehm's avatar
tbrehm committed
273
274
275
</tmpl_loop>
</tmpl_if>

276
<tmpl_var name='apache_directives'>
tbrehm's avatar
tbrehm committed
277
</VirtualHost>
tbrehm's avatar
tbrehm committed
278
</IfModule>
tbrehm's avatar
tbrehm committed
279
280

</tmpl_if>