vhost.conf.master 13.2 KB
Newer Older
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

<Directory {tmpl_var name='web_basedir'}/{tmpl_var name='domain'}>
    AllowOverride None
    Order Deny,Allow
    Deny from all
</Directory>

<VirtualHost <tmpl_var name='ip_address'>:80>
<tmpl_if name='php' op='==' value='suphp'>
    DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
  <tmpl_if name='php' op='==' value='cgi'>
    DocumentRoot <tmpl_var name='web_document_root'>
  </tmpl_else>
    DocumentRoot <tmpl_var name='web_document_root_www'>
  </tmpl_if>
</tmpl_if>

    ServerName <tmpl_var name='domain'>
<tmpl_if name='alias'>
    <tmpl_var name='alias'>
</tmpl_if>
    ServerAdmin webmaster@<tmpl_var name='domain'>

    ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log
26

27 28 29 30 31 32 33 34 35 36 37 38 39
<tmpl_if name='errordocs'>

    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
</tmpl_if>
	
    <Directory {tmpl_var name='web_document_root_www'}>
        Options FollowSymLinks
40
        AllowOverride <tmpl_var name='allow_override'>
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
        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'>
        <Files ~ '.php[s3-6]{0,1}$'>
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>
    <Directory {tmpl_var name='web_document_root'}>
        Options FollowSymLinks
60
        AllowOverride <tmpl_var name='allow_override'>
61 62 63 64 65 66 67 68 69
        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
70 71 72 73 74 75 76 77 78
<tmpl_if name='php' op='==' value='no'>
        <Files ~ '.php[s3-6]{0,1}$'>
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
<tmpl_if name='ruby' op='==' value='y'>
    <IfModule mod_ruby.c>
      <Directory {tmpl_var name='web_document_root'}>
        Options +ExecCGI
      </Directory>
      RubyRequire apache/ruby-run
      #RubySafeLevel 0
      <Files *.rb>
        SetHandler ruby-object
        RubyHandler Apache::RubyRun.instance
      </Files>
      <Files *.rbx>
        SetHandler ruby-object
        RubyHandler Apache::RubyRun.instance
      </Files>
    </IfModule>
</tmpl_if>

97 98 99 100 101 102 103 104 105 106 107 108 109 110
<tmpl_if name='cgi' op='==' value='y'>
    # cgi enabled
	<Directory {tmpl_var name='document_root'}/cgi-bin>
      Order allow,deny
      Allow from all
    </Directory>
    ScriptAlias  /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
</tmpl_if>
<tmpl_if name='suexec' op='==' value='y'>
    # suexec enabled
    SuexecUserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
</tmpl_if>
111 112 113 114
    # Clear PHP settings of this website
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler None
    </FilesMatch>
115 116 117
<tmpl_if name='php' op='==' value='mod'>
    # mod_php enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
tbrehm's avatar
tbrehm committed
118
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>"	
119 120
    php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp
    php_admin_value session.save_path <tmpl_var name='document_root'>/tmp
121
	# PHPIniDir <tmpl_var name='custom_php_ini_dir'>
tbrehm's avatar
tbrehm committed
122
<tmpl_if name='security_level' op='==' value='20'>
123
    php_admin_value open_basedir <tmpl_var name='php_open_basedir'>
tbrehm's avatar
tbrehm committed
124
</tmpl_if>
125 126 127 128
</tmpl_if>
<tmpl_if name='php' op='==' value='suphp'>
    # suphp enabled
    <Directory {tmpl_var name='web_document_root'}>
129
		<IfModule mod_suphp.c>
130 131
        suPHP_Engine on
        # suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
132 133 134
<tmpl_if name='has_custom_php_ini'>
	suPHP_ConfigPath <tmpl_var name='custom_php_ini_dir'>
</tmpl_if>
135 136
        AddHandler x-httpd-suphp .php .php3 .php4 .php5
        suPHP_AddHandler x-httpd-suphp
137
		</IfModule>
138 139 140 141 142 143 144 145 146 147 148 149 150 151
    </Directory>
</tmpl_if>
<tmpl_if name='php' op='==' value='cgi'>
    # php as cgi enabled
    ScriptAlias /php5-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
    Action php5-cgi /php5-cgi
    AddHandler php5-cgi .php .php3 .php4 .php5
    <Directory {tmpl_var name='cgi_starter_path'}>
        Order allow,deny
        Allow from all
    </Directory>
</tmpl_if>
<tmpl_if name='php' op='==' value='fast-cgi'>
    # php as fast-cgi enabled
tbrehm's avatar
tbrehm committed
152
	# For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
tbrehm's avatar
tbrehm committed
153
    <IfModule mod_fcgid.c>
tbrehm's avatar
tbrehm committed
154
<tmpl_if name='fastcgi_config_syntax' op='==' value='2'>
tbrehm's avatar
tbrehm committed
155 156 157 158 159 160 161 162
	  FcgidIdleTimeout 300
	  FcgidProcessLifeTime 3600
	  FcgidMaxProcesses 1000
	  FcgidMinProcessesPerClass 0
	  FcgidMaxProcessesPerClass 100
	  FcgidConnectTimeout 3
	  FcgidIOTimeout 360
	  FcgidBusyTimeout 300
tbrehm's avatar
tbrehm committed
163 164 165
<tmpl_else>
	  IdleTimeout 300
	  ProcessLifeTime 3600
166
	  # MaxProcessCount 1000
tbrehm's avatar
tbrehm committed
167 168 169 170 171 172
	  DefaultMinClassProcessCount 0
	  DefaultMaxClassProcessCount 100
	  IPCConnectTimeout 3
	  IPCCommTimeout 360
	  BusyTimeout 300
</tmpl_if>
tbrehm's avatar
tbrehm committed
173
    </IfModule>
174 175 176 177
    <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
178
        AllowOverride <tmpl_var name='allow_override'>
179 180 181
        Order allow,deny
        Allow from all
    </Directory>
182 183 184 185 186 187 188 189
	<Directory {tmpl_var name='web_document_root'}>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
        Options +ExecCGI
        AllowOverride <tmpl_var name='allow_override'>
        Order allow,deny
        Allow from all
    </Directory>
190 191 192 193 194
</tmpl_if>
<tmpl_if name="rewrite_enabled">
    
    RewriteEngine on
<tmpl_loop name="redirects">
195
    RewriteCond %{HTTP_HOST}   <tmpl_var name='rewrite_domain'>$ [NC]
196 197 198 199
    RewriteRule   ^/(.*)$ <tmpl_var name='rewrite_target'>$1  <tmpl_var name='rewrite_type'>
</tmpl_loop>
</tmpl_if>

tbrehm's avatar
tbrehm committed
200 201 202 203 204
    # add support for apache mpm_itk
    <IfModule mpm_itk_module>
      AssignUserId <tmpl_var name='system_user'> <tmpl_var name='system_group'>
    </IfModule>

vogelor's avatar
vogelor committed
205
    <IfModule mod_dav_fs.c>
206 207 208 209 210 211
      # DO NOT REMOVE THE COMMENTS!
      # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
      # WEBDAV BEGIN
      # WEBDAV END
    </IfModule>

212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
<tmpl_var name='apache_directives'>
</VirtualHost>



<tmpl_if name='ssl_enabled'>
<IfModule mod_ssl.c>
###########################################################
# SSL Vhost
###########################################################

<VirtualHost <tmpl_var name='ip_address'>:443>
<tmpl_if name='php' op='==' value='suphp'>
    DocumentRoot <tmpl_var name='web_document_root'>
</tmpl_else>
  <tmpl_if name='php' op='==' value='cgi'>
    DocumentRoot <tmpl_var name='web_document_root'>
  </tmpl_else>
    DocumentRoot <tmpl_var name='web_document_root_www'>
  </tmpl_if>
</tmpl_if>

vogelor's avatar
vogelor committed
234
    ServerName <tmpl_var name='ssl_domain'>
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
<tmpl_if name='alias'>
    <tmpl_var name='alias'>
</tmpl_if>
    ServerAdmin webmaster@<tmpl_var name='domain'>
    
    ErrorLog /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log

<tmpl_if name='errordocs'>
    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

</tmpl_if>
    SSLEngine on
vogelor's avatar
vogelor committed
253 254
    SSLCertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt
    SSLCertificateKeyFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key
255
<tmpl_if name='has_bundle_cert'>
vogelor's avatar
vogelor committed
256
    SSLCACertificateFile <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.bundle
257 258 259 260
</tmpl_if>
    
	<Directory {tmpl_var name='web_document_root_www'}>
        Options FollowSymLinks
261
        AllowOverride <tmpl_var name='allow_override'>
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
        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'>
        <Files ~ '.php[s3-6]{0,1}$'>
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>
    <Directory {tmpl_var name='web_document_root'}>
        Options FollowSymLinks
281
        AllowOverride <tmpl_var name='allow_override'>
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
        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'>
        <Files ~ '.php[s3-6]{0,1}$'>
            Order allow,deny
            Deny from all
            Allow from none
        </Files>
</tmpl_if>
    </Directory>

<tmpl_if name='cgi' op='==' value='y'>
    # cgi enabled
	<Directory {tmpl_var name='document_root'}/cgi-bin>
      Order allow,deny
      Allow from all
    </Directory>
    ScriptAlias  /cgi-bin/ <tmpl_var name='document_root'>/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
</tmpl_if>
<tmpl_if name='ssi'op='==' value='y'>
    # ssi enabled
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</tmpl_if>
<tmpl_if name='suexec'op='==' value='y'>
    # suexec enabled
    SuexecUserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
</tmpl_if>
319 320 321 322
# Clear PHP settings of this website
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler None
    </FilesMatch>
323 324 325
<tmpl_if name='php' op='==' value='mod'>
    # mod_php enabled
    AddType application/x-httpd-php .php .php3 .php4 .php5
tbrehm's avatar
tbrehm committed
326
    php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -fwebmaster@<tmpl_var name='domain'>"	
327 328
    php_admin_value upload_tmp_dir <tmpl_var name='document_root'>/tmp
    php_admin_value session.save_path <tmpl_var name='document_root'>/tmp
329
	# PHPIniDir <tmpl_var name='custom_php_ini_dir'>
tbrehm's avatar
tbrehm committed
330
<tmpl_if name='security_level' op='==' value='20'>
331
    php_admin_value open_basedir <tmpl_var name='php_open_basedir'>
tbrehm's avatar
tbrehm committed
332
</tmpl_if>
333 334
</tmpl_if>
<tmpl_if name='php' op='==' value='suphp'>
335 336 337 338 339
    # suphp enabled
    <Directory {tmpl_var name='web_document_root'}>
		<IfModule mod_suphp.c>
        suPHP_Engine on
        # suPHP_UserGroup <tmpl_var name='system_user'> <tmpl_var name='system_group'>
340 341 342
<tmpl_if name='has_custom_php_ini'>
	suPHP_ConfigPath <tmpl_var name='custom_php_ini_dir'>
</tmpl_if>
343 344 345 346
        AddHandler x-httpd-suphp .php .php3 .php4 .php5
        suPHP_AddHandler x-httpd-suphp
		</IfModule>
    </Directory>
347 348 349 350 351 352 353 354 355 356 357 358 359
</tmpl_if>
<tmpl_if name='php' op='==' value='cgi'>
    # php as cgi enabled
    ScriptAlias /php5-cgi <tmpl_var name='cgi_starter_path'><tmpl_var name='cgi_starter_script'>
    Action php5-cgi /php5-cgi
    AddHandler php5-cgi .php .php3 .php4 .php5
	<Directory {tmpl_var name='cgi_starter_path'}>
        Order allow,deny
        Allow from all
    </Directory>
</tmpl_if>
<tmpl_if name='php' op='==' value='fast-cgi'>
    # php as fast-cgi enabled
360
	# See: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
tbrehm's avatar
tbrehm committed
361
    <IfModule mod_fcgid.c>
tbrehm's avatar
tbrehm committed
362
<tmpl_if name='fastcgi_config_syntax' op='==' value='2'>
363
	  FcgidIdleTimeout 300
364 365
	  FcgidProcessLifeTime 3600
	  FcgidMaxProcesses 1000
366
	  FcgidMinProcessesPerClass 0
367 368 369
	  FcgidMaxProcessesPerClass 100
	  FcgidConnectTimeout 3
	  FcgidIOTimeout 360
370
	  FcgidBusyTimeout 300
tbrehm's avatar
tbrehm committed
371 372 373
<tmpl_else>
	  IdleTimeout 300
	  ProcessLifeTime 3600
374
	  # MaxProcessCount 1000
tbrehm's avatar
tbrehm committed
375 376 377 378 379 380
	  DefaultMinClassProcessCount 0
	  DefaultMaxClassProcessCount 100
	  IPCConnectTimeout 3
	  IPCCommTimeout 360
	  BusyTimeout 300
</tmpl_if>
tbrehm's avatar
tbrehm committed
381
    </IfModule>
382 383 384 385
    <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
386
        AllowOverride <tmpl_var name='allow_override'>
387 388 389
        Order allow,deny
        Allow from all
    </Directory>
390 391 392 393 394 395 396 397
	<Directory {tmpl_var name='web_document_root'}>
        AddHandler fcgid-script .php .php3 .php4 .php5
        FCGIWrapper <tmpl_var name='fastcgi_starter_path'><tmpl_var name='fastcgi_starter_script'> .php
        Options +ExecCGI
        AllowOverride <tmpl_var name='allow_override'>
        Order allow,deny
        Allow from all
    </Directory>
398 399 400 401 402 403 404 405 406 407
</tmpl_if>
<tmpl_if name="rewrite_enabled">
    
    RewriteEngine on
<tmpl_loop name="redirects">
    RewriteCond %{HTTP_HOST}   ^<tmpl_var name='rewrite_domain'> [NC]
    RewriteRule   ^/(.*)$ <tmpl_var name='rewrite_target'>$1  <tmpl_var name='rewrite_type'>
</tmpl_loop>
</tmpl_if>

tbrehm's avatar
tbrehm committed
408 409 410 411 412
    # add support for apache mpm_itk
    <IfModule mpm_itk_module>
      AssignUserId <tmpl_var name='system_user'> <tmpl_var name='system_group'>
    </IfModule>

413
    <IfModule mod_dav_fs.c>
414 415 416 417 418 419
      # DO NOT REMOVE THE COMMENTS!
      # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
      # WEBDAV BEGIN
      # WEBDAV END
    </IfModule>

420 421 422 423
<tmpl_var name='apache_directives'>
</VirtualHost>
</IfModule>

tbrehm's avatar
tbrehm committed
424
</tmpl_if>