How to define a variable in apache's httpd.conf file?

后端 未结 5 503
借酒劲吻你
借酒劲吻你 2020-12-01 01:01

I want to define a variable in Apache server\'s httpd.conf configuration file.

Ex: variable static_path = C:\\codebase\\snp_static

5条回答
  •  一生所求
    2020-12-01 02:01

    Apache2.4 I researched it out and here is what worked for me. and tested using httpd_z.exe -t -D DUMP_RUN_CFG

       RESULTS:::
        ServerRoot: "C:/path/core/apache2"
        Main DocumentRoot: "C:/path/apache/htdocs"
        Main ErrorLog: "C:/path/core/apache2/logs/error.log"
        Mutex rewrite-map: using_defaults
        Mutex default: dir="C:/path/core/apache2/logs/" mechanism=default
        PidFile: "C:/path/core/apache2/logs/httpd.pid"
        Define: DUMP_RUN_CFG
        Define: US_ROOTF=C:/path   **THIS IS THE ROOT PATH VARIABLE I JUST MADE**
        Define: php54
    
    
      #
        #  Define servername test.example.com
        #
        #
        #  Define servername www.example.com
        #  Define SSL
        #
        #DocumentRoot /var/www/${servername}/htdocs
    
     Define US_ROOTF C:/PATH   **The path i want the variable for**
    
    
     Define US_ROOTF C:/PATH    **The path i want the variable for**
    #  Define SSL
    
    #DocumentRoot /var/www/${servername}/htdocs  OPTIONS ON HOW TO USE
    
    EXAMPLE of use 
    ServerRoot = ${US_ROOTF}
    
      LoadFile "${US_ROOTF}/core/php54/icudt53.dll"
    PHPIniDir "${US_ROOTF}/core/php54/php_production.ini"
    

    I was told never to use a direct HARD path to anything when serving something to the internet always use variables to help secure your system.

    I found the hard way this is so true. Now I finally figured out how to set the variables for all services dealing with Apache i use them.

    Hope it helps you too.

提交回复
热议问题