Is it possible to use variables in httpd.conf

前端 未结 2 1543
谎友^
谎友^ 2021-02-05 01:46

Is there a way to use variables of some sort in an apache httpd.conf file? I\'d like to define a value and use it throughout a block, as in

define myva         


        
2条回答
  •  甜味超标
    2021-02-05 02:17

    Try mod_macro. It actually allows you to use what are essentially variables. An example from the module's docs page gives the gist of it:

    ## Define a VHost Macro for repetitive configurations
    
    
      Listen $port
      
    
        ServerName $host
        DocumentRoot $dir
    
        
          # do something here...
        
    
        # limit access to intranet subdir.
        
          Require ip 10.0.0.0/8
        
      
    
    
    ## Use of VHost with different arguments.
    
    Use VHost www.apache.org 80 /vhosts/apache/htdocs
    Use VHost example.org 8080 /vhosts/example/htdocs
    Use VHost www.example.fr 1234 /vhosts/example.fr/htdocs
    

    I found a download for it at http://www.cri.ensmp.fr/~coelho/mod_macro/

提交回复
热议问题