如何定义在Apache的httpd.conf文件中的变量? [英] How to define a variable in apache's httpd.conf file?

查看:635
本文介绍了如何定义在Apache的httpd.conf文件中的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要定义Apache服务器的的httpd.conf 配置文件中的变量。

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

例如:变量static_path = C:\\ codeBase的\\ snp_static

Ex: variable static_path = C:\codebase\snp_static

和我想在的httpd.conf 来使用这个变量(static_path)在以往任何时候必需的。

and I want to use this variable (static_path) in httpd.conf where ever required.

请告诉我如何可以定义的httpd.conf 变量文件?

Please tell me how can define a variable in httpd.conf file ?

推荐答案

的httpd.conf ,用你声明的变量(S):定义($ p在第一行pferably $)

语法定义 变量名 变量值

Within httpd.conf, declare your variable(s) with: Define (Preferably at the very first line)
Syntax: Define variable-name variable-value

在这种方式:

#The line below creates [static_path]
Define static_path C:/codebase/snp_static

您可以在以后使用这个变量,像这样:

You can later use this variable like so:

ServerRoot = ${static_path}
...
DocumentRoot = ${static_path}
...
<Directory ${static_path}>
...etc.

您甚至可以将它们组合起来:

You can even combine them:

Define server_space c:/
Define static_path codebase/snp_static
...
ServerRoot = ${server_space}${static_path}
...
DocumentRoot = ${server_space}${static_path}
...
<Directory ${server_space}${static_path}>
...etc.

文档:<一href=\"http://httpd.apache.org/docs/2.4/mod/core.html#define\">http://httpd.apache.org/docs/2.4/mod/core.html#define

这篇关于如何定义在Apache的httpd.conf文件中的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆