Marius Cramer
2014-08-13 31230cb7cda673db7a96fb14d93dfaf9262c74cf
commit | author | age
47cca9 1
T 2 <Directory {tmpl_var name='web_basedir'}/{tmpl_var name='domain'}>
0305b2 3         AllowOverride None
1da57c 4         <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
7ae7e8 5         Require all denied
1da57c 6         <tmpl_else>
0305b2 7         Order Deny,Allow
M 8         Deny from all
1da57c 9         </tmpl_if>
47cca9 10 </Directory>
T 11
a7bdf8 12 <tmpl_loop name="vhosts">
T 13 <VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}>
47cca9 14 <tmpl_if name='php' op='==' value='suphp'>
0305b2 15         DocumentRoot <tmpl_var name='web_document_root'>
47cca9 16 </tmpl_else>
0305b2 17     <tmpl_if name='php' op='==' value='cgi'>
M 18         DocumentRoot <tmpl_var name='web_document_root'>
19     </tmpl_else>
cc6568 20         <tmpl_if name='php' op='==' value='php-fpm'>
H 21         DocumentRoot <tmpl_var name='web_document_root'>
22         </tmpl_else>
0305b2 23         DocumentRoot <tmpl_var name='web_document_root_www'>
cc6568 24         </tmpl_if>
0305b2 25     </tmpl_if>
47cca9 26 </tmpl_if>
T 27
0305b2 28         ServerName <tmpl_var name='domain'>
47cca9 29 <tmpl_if name='alias'>
0305b2 30         <tmpl_var name='alias'>
47cca9 31 </tmpl_if>
0305b2 32         ServerAdmin webmaster@<tmpl_var name='domain'>
47cca9 33
0305b2 34         ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
3e0034 35
47cca9 36 <tmpl_if name='errordocs'>
0305b2 37         Alias /error/ "<tmpl_var name='web_document_root_www'>/error/"
M 38         ErrorDocument 400 /error/400.html
39         ErrorDocument 401 /error/401.html
40         ErrorDocument 403 /error/403.html
41         ErrorDocument 404 /error/404.html
42         ErrorDocument 405 /error/405.html
43         ErrorDocument 500 /error/500.html
44         ErrorDocument 502 /error/502.html
45         ErrorDocument 503 /error/503.html
47cca9 46 </tmpl_if>
a7bdf8 47
0305b2 48         <IfModule mod_ssl.c>
a7bdf8 49 <tmpl_if name='ssl_enabled'>
T 50     SSLEngine on
0305b2 51         SSLCertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt
M 52         SSLCertificateKeyFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key
a7bdf8 53 <tmpl_if name='has_bundle_cert'>
0305b2 54         SSLCACertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.bundle
a7bdf8 55 </tmpl_if>
dec0df 56 </tmpl_if>
0305b2 57         </IfModule>
dec0df 58
0305b2 59         <Directory {tmpl_var name='web_document_root_www'}>
5545f1 60                 Options +FollowSymLinks
0305b2 61                 AllowOverride <tmpl_var name='allow_override'>
1da57c 62                 <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 63                 Require all granted
1da57c 64                 <tmpl_else>
0305b2 65                 Order allow,deny
M 66                 Allow from all
1da57c 67                 </tmpl_if>
47cca9 68 <tmpl_if name='ssi' op='==' value='y'>
0305b2 69
M 70                 # ssi enabled
71                 AddType text/html .shtml
72                 AddOutputFilter INCLUDES .shtml
73                 Options +Includes
47cca9 74 </tmpl_if>
T 75 <tmpl_if name='php' op='==' value='no'>
0305b2 76                 <Files ~ '.php[s3-6]{0,1}$'>
1da57c 77                         <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 78                         Require all denied
1da57c 79                         <tmpl_else>
0305b2 80                         Order allow,deny
M 81                         Deny from all
82                         Allow from none
1da57c 83                         </tmpl_if>
0305b2 84                 </Files>
47cca9 85 </tmpl_if>
0305b2 86         </Directory>
M 87         <Directory {tmpl_var name='web_document_root'}>
5545f1 88                 Options +FollowSymLinks
0305b2 89                 AllowOverride <tmpl_var name='allow_override'>
1da57c 90                 <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 91                 Require all granted
1da57c 92                 <tmpl_else>
0305b2 93                 Order allow,deny
M 94                 Allow from all
1da57c 95                 </tmpl_if>
47cca9 96 <tmpl_if name='ssi' op='==' value='y'>
0305b2 97
M 98                 # ssi enabled
99                 AddType text/html .shtml
100                 AddOutputFilter INCLUDES .shtml
101                 Options +Includes
47cca9 102 </tmpl_if>
07d3a1 103 <tmpl_if name='php' op='==' value='no'>
0305b2 104                 <Files ~ '.php[s3-6]{0,1}$'>
1da57c 105                     <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 106                     Require all denied
1da57c 107                     <tmpl_else>
8133de 108                     Order allow,deny
MC 109                     Deny from all
110                     Allow from none
1da57c 111                     </tmpl_if>
0305b2 112                 </Files>
07d3a1 113 </tmpl_if>
0305b2 114         </Directory>
07d3a1 115
22ef48 116 <tmpl_if name='ruby' op='==' value='y'>
0305b2 117         <IfModule mod_ruby.c>
M 118             <Directory {tmpl_var name='web_document_root_www'}>
119                 Options +ExecCGI
120             </Directory>
121             RubyRequire apache/ruby-run
122             #RubySafeLevel 0
123             AddType text/html .rb
124             AddType text/html .rbx
125             <Files *.rb>
126                 SetHandler ruby-object
127                 RubyHandler Apache::RubyRun.instance
128             </Files>
129             <Files *.rbx>
130                 SetHandler ruby-object
131                 RubyHandler Apache::RubyRun.instance
132             </Files>
133         </IfModule>
22ef48 134 </tmpl_if>
47cca9 135
ab7597 136 <tmpl_if name='perl' op='==' value='y'>
M 137         <IfModule mod_perl.c>
138             PerlModule ModPerl::Registry
139             PerlModule Apache2::Reload
140             <Directory {tmpl_var name='web_document_root_www'}>
141                 PerlResponseHandler ModPerl::Registry
142                 PerlOptions +ParseHeaders
143                 Options +ExecCGI
144             </Directory>
72d6a8 145             <Directory {tmpl_var name='web_document_root'}>
TB 146                 PerlResponseHandler ModPerl::Registry
147                 PerlOptions +ParseHeaders
148                 Options +ExecCGI
149             </Directory>
6fb93d 150             <Files *.pl>
M 151                 SetHandler perl-script
152             </Files>
ab7597 153         </IfModule>
M 154 </tmpl_if>
155
298ef5 156 <tmpl_if name='python' op='==' value='y'>
0305b2 157         <IfModule mod_python.c>
M 158             <Directory {tmpl_var name='web_document_root_www'}>
3bc1e1 159                 <FilesMatch "\.py$">
MC 160                     SetHandler mod_python
161                 </FilesMatch>
0305b2 162                 PythonHandler mod_python.publisher
M 163                 PythonDebug On
164             </Directory>
165         </IfModule>
298ef5 166 </tmpl_if>
F 167
47cca9 168 <tmpl_if name='cgi' op='==' value='y'>
0305b2 169         # cgi enabled
47cca9 170     <Directory {tmpl_var name='document_root'}/cgi-bin>
1da57c 171             <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 172             Require all granted
1da57c 173             <tmpl_else>
0305b2 174             Order allow,deny
M 175             Allow from all
1da57c 176             </tmpl_if>
0305b2 177         </Directory>
M 178         ScriptAlias  /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
3bc1e1 179         <FilesMatch "\.(cgi|pl)$">
MC 180             SetHandler cgi-script
181         </FilesMatch>
47cca9 182 </tmpl_if>
T 183 <tmpl_if name='suexec' op='==' value='y'>
0305b2 184         # suexec enabled
M 185         <IfModule mod_suexec.c>
186             SuexecUserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
187         </IfModule>
47cca9 188 </tmpl_if>
0305b2 189         # Clear PHP settings of this website
c0a1a4 190         <FilesMatch ".+\.ph(p[345]?|t|tml)$">
0305b2 191                 SetHandler None
M 192         </FilesMatch>
47cca9 193 <tmpl_if name='php' op='==' value='mod'>
0305b2 194         # mod_php enabled
M 195         AddType application/x-httpd-php .php .php3 .php4 .php5
196         php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>"
197         php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp
198         php_admin_value session.save_path <tmpl_var name='document_root'>/tmp
10f838 199     # PHPIniDir <tmpl_var name='custom_php_ini_dir'>
215d18 200 <tmpl_if name='security_level' op='==' value='20'>
0305b2 201         php_admin_value open_basedir <tmpl_var name='php_open_basedir'>
215d18 202 </tmpl_if>
47cca9 203 </tmpl_if>
T 204 <tmpl_if name='php' op='==' value='suphp'>
0305b2 205         # suphp enabled
M 206         <Directory {tmpl_var name='web_document_root'}>
f8d8a4 207         <IfModule mod_suphp.c>
3bc1e1 208             suPHP_Engine on
MC 209             # suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
7fddfe 210 <tmpl_if name='has_custom_php_ini'>
T 211     suPHP_ConfigPath <tmpl_var name='custom_php_ini_dir'>
212 </tmpl_if>
3bc1e1 213             <FilesMatch "\.php[345]?$">
MC 214                 SetHandler x-httpd-suphp
215             </FilesMatch>
216             suPHP_AddHandler x-httpd-suphp
f8d8a4 217         </IfModule>
0305b2 218         </Directory>
47cca9 219 </tmpl_if>
T 220 <tmpl_if name='php' op='==' value='cgi'>
0305b2 221         # php as cgi enabled
M 222         ScriptAlias /php5-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
223         Action php5-cgi /php5-cgi
3bc1e1 224         <FilesMatch "\.php[345]?$">
MC 225             SetHandler php5-cgi
226         </FilesMatch>
0305b2 227         <Directory {tmpl_var name='cgi_starter_path'}>
1da57c 228             <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 229             Require all granted
1da57c 230             <tmpl_else>
8133de 231             Order allow,deny
MC 232             Allow from all
1da57c 233             </tmpl_if>
0305b2 234         </Directory>
47cca9 235 </tmpl_if>
T 236 <tmpl_if name='php' op='==' value='fast-cgi'>
0305b2 237         # php as fast-cgi enabled
8fe84f 238     # For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
0305b2 239         <IfModule mod_fcgid.c>
92e0ce 240 <tmpl_if name='fastcgi_config_syntax' op='==' value='2'>
0305b2 241                 FcgidIdleTimeout 300
M 242                 FcgidProcessLifeTime 3600
243                 # FcgidMaxProcesses 1000
bfcdef 244                 FcgidMaxRequestsPerProcess <tmpl_var name='fastcgi_max_requests'>
0305b2 245                 FcgidMinProcessesPerClass 0
310f4c 246                 FcgidMaxProcessesPerClass 10
0305b2 247                 FcgidConnectTimeout 3
2ed8f0 248                 FcgidIOTimeout 600
MC 249                 FcgidBusyTimeout 3600
bfcdef 250                 FcgidMaxRequestLen 1073741824
92e0ce 251 <tmpl_else>
0305b2 252                 IdleTimeout 300
M 253                 ProcessLifeTime 3600
254                 # MaxProcessCount 1000
255                 DefaultMinClassProcessCount 0
256                 DefaultMaxClassProcessCount 100
257                 IPCConnectTimeout 3
2ed8f0 258                 IPCCommTimeout 600
MC 259                 BusyTimeout 3600
92e0ce 260 </tmpl_if>
0305b2 261         </IfModule>
M 262         <Directory {tmpl_var name='web_document_root_www'}>
3bc1e1 263                 <FilesMatch "\.php[345]?$">
MC 264                     SetHandler fcgid-script
265                 </FilesMatch>
0305b2 266                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
c0a1a4 267                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php3
TB 268                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php4
269                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php5
0305b2 270                 Options +ExecCGI
M 271                 AllowOverride <tmpl_var name='allow_override'>
1da57c 272                 <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 273                 Require all granted
1da57c 274                 <tmpl_else>
0305b2 275                 Order allow,deny
M 276                 Allow from all
1da57c 277                 </tmpl_if>
0305b2 278         </Directory>
M 279         <Directory {tmpl_var name='web_document_root'}>
3bc1e1 280                 <FilesMatch "\.php[345]?$">
MC 281                     SetHandler fcgid-script
282                 </FilesMatch>
0305b2 283                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
c0a1a4 284                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php3
TB 285                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php4
286                 FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php5
0305b2 287                 Options +ExecCGI
M 288                 AllowOverride <tmpl_var name='allow_override'>
1da57c 289                 <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 290                 Require all granted
1da57c 291                 <tmpl_else>
0305b2 292                 Order allow,deny
M 293                 Allow from all
1da57c 294                 </tmpl_if>
0305b2 295         </Directory>
47cca9 296 </tmpl_if>
274362 297 <tmpl_if name='php' op='==' value='php-fpm'>
0305b2 298         <IfModule mod_fastcgi.c>
10b4c8 299                 <Directory {tmpl_var name='document_root'}/cgi-bin>
1da57c 300                     <tmpl_if name='apache_version' op='>' value='2.2' format='version'>
8133de 301                     Require all granted
1da57c 302                     <tmpl_else>
8133de 303                     Order allow,deny
MC 304                     Allow from all
1da57c 305                     </tmpl_if>
52846b 306                 </Directory>
3bc1e1 307                 <FilesMatch "\.php[345]?$">
MC 308                     SetHandler php5-fcgi
309                 </FilesMatch>
52846b 310                 Action php5-fcgi /php5-fcgi
bfcdef 311                 Alias /php5-fcgi {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'}
274362 312 <tmpl_if name='use_tcp'>
cc6568 313                 FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -host 127.0.0.1:<tmpl_var name='fpm_port'> -pass-header Authorization
274362 314 </tmpl_if>
F 315 <tmpl_if name='use_socket'>
cc6568 316                 FastCgiExternalServer {tmpl_var name='document_root'}/cgi-bin/php5-fcgi-{tmpl_var name='ip_address'}-{tmpl_var name='port'}-{tmpl_var name='domain'} -idle-timeout 300 -socket <tmpl_var name='fpm_socket'> -pass-header Authorization
274362 317 </tmpl_if>
0305b2 318         </IfModule>
274362 319 </tmpl_if>
e64fbb 320
8ab3cd 321 <tmpl_if name="rewrite_enabled">
0305b2 322         RewriteEngine on
8ab3cd 323 <tmpl_if name='seo_redirect_enabled'>
bfcdef 324         RewriteCond %{HTTP_HOST} <tmpl_var name='seo_redirect_operator'>^<tmpl_var name='seo_redirect_origin_domain'>$ [NC]
cc6568 325         RewriteRule ^(.*)$ http<tmpl_if name='ssl_enabled'>s</tmpl_if>://<tmpl_var name='seo_redirect_target_domain'>$1 [R=301,L]
e64fbb 326 </tmpl_if>
bfcdef 327 <tmpl_loop name="alias_seo_redirects">
T 328         RewriteCond %{HTTP_HOST} <tmpl_var name='alias_seo_redirect_operator'>^<tmpl_var name='alias_seo_redirect_origin_domain'>$ [NC]
cc6568 329         RewriteRule ^(.*)$ http<tmpl_if name='ssl_enabled'>s</tmpl_if>://<tmpl_var name='alias_seo_redirect_target_domain'>$1 [R=301,L]
bfcdef 330 </tmpl_loop>
47cca9 331 <tmpl_loop name="redirects">
0305b2 332         RewriteCond %{HTTP_HOST}   <tmpl_var name='rewrite_domain'>$ [NC]
046d62 333 <tmpl_if name="rewrite_is_url" op="==" value="n">
M 334         RewriteCond %{REQUEST_URI} !^/webdav/
6f4f6b 335         RewriteCond %{REQUEST_URI} !^/php5-fcgi/
046d62 336         RewriteCond %{REQUEST_URI} !^<tmpl_var name='rewrite_target'>
M 337 </tmpl_if>
6f833c 338         
MC 339         RewriteRule   ^/(.*)$ <tmpl_var name='rewrite_target'><tmpl_if name="rewrite_add_path" op="==" value="y">$1</tmpl_if>  <tmpl_if name='rewrite_type' value=''><tmpl_if name="rewrite_is_url" op="==" value="n">[PT]</tmpl_if></tmpl_else><tmpl_var name='rewrite_type'></tmpl_if>
340     
47cca9 341 </tmpl_loop>
T 342 </tmpl_if>
343
0305b2 344         # add support for apache mpm_itk
M 345         <IfModule mpm_itk_module>
346             AssignUserId <tmpl_var name='system_user'> <tmpl_var name='system_group'>
347         </IfModule>
c4570e 348
0305b2 349         <IfModule mod_dav_fs.c>
M 350         # Do not execute PHP files in webdav directory
351             <Directory {tmpl_var name='document_root'}/webdav>
7762fb 352                 <ifModule mod_security2.c>
M 353                     SecRuleRemoveById 960015
354                     SecRuleRemoveById 960032
355                 </ifModule>
356                 <FilesMatch "\.ph(p3?|tml)$">
0305b2 357                     SetHandler None
M 358                 </FilesMatch>
359             </Directory>
360             DavLockDB {tmpl_var name='document_root'}/tmp/DavLock
361             # DO NOT REMOVE THE COMMENTS!
362             # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
363             # WEBDAV BEGIN
364             # WEBDAV END
365         </IfModule>
ac933e 366
47cca9 367 <tmpl_var name='apache_directives'>
T 368 </VirtualHost>
a7bdf8 369 </tmpl_loop>