zoukankan      html  css  js  c++  java
  • apache SetEnv 设置

    php的服务器预定义变量 $_SERVER

    可以通过apache的mod_env模块来添加我们所需要的内容

    来段官网介绍

    Description: Modifies the environment which is passed to CGI scripts and SSI pages
    Status: Base
    Module Identifier: env_module
    Source File: mod_env.c

     

     

     

    Summary

    This module allows for control of internal environment variables that are used by various Apache HTTP Server modules. These variables are also provided to CGI scripts as native system environment variables, and available for use in SSI pages. Environment variables may be passed from the shell which invoked the httpd process. Alternatively, environment variables may be set or unset within the configuration process.

    可以通过 SetEnv来向apache虚拟主机配置文件里写一些我们需要的东西

    对setenv来段官网介绍

    Description: Sets environment variables
    Syntax: SetEnv env-variable [value]
    Context: server config, virtual host, directory, .htaccess
    Override: FileInfo
    Status: Base
    Module: mod_env

    Sets an internal environment variable, which is then available to Apache HTTP Server modules, and passed on to CGI scripts and SSI pages.

    Example

    SetEnv SPECIAL_PATH /foo/bin

    If you omit the value argument, the variable is set to an empty string.

    来段配置实例

    <VirtualHost *:80>
    ServerName aa.com
    DocumentRoot /var/www
    AddDefaultCharset UTF-8
    <IfModule mod_rewrite.c>
    RewriteEngine on
    #RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !.(js|ico|gif|jpg|png|css|xml|swf|cur|html|apk|manifest)$ /index.php
    </IfModule>
    SetEnv RUN_MODE production
    </VirtualHost>

    就是红色部分了,可以在php里使用$_SERVER['RUN_MODE']来进行调用和判断,这样在本地开发环境中不配置这个变量,在服务器上配置这个变量,可以写两份配置文件,判断这个变量的不同,从而调用不同的配置文件来进行开发.

  • 相关阅读:
    Android中的httpclient框架发送get请求
    成员函数的重载&amp;&amp;隐藏&amp;&amp;覆盖
    子墨庖丁Android的ActionBar源代码分析 (一)实例化
    Hadoop2.x介绍与源代码编译
    NFS 服务器的配置
    tftp 服务器的配置
    LINUX内核及应用程序移植工作
    u-boot 移植工作目录
    Linux 下工作用户及环境
    zless
  • 原文地址:https://www.cnblogs.com/debmzhang/p/3374674.html
Copyright © 2011-2022 走看看