当前位置:首页>开发>正文

如何在nginx中使用系统的环境变量 nginx.conf配置的root目录要什么权限

2023-07-07 13:49:32 互联网 未知 开发

 如何在nginx中使用系统的环境变量 nginx.conf配置的root目录要什么权限

如何在nginx中使用系统的环境变量

在upstream中使用nginx变量的方法
操作流程是:
1. 创建upstream数据结构。

if (ngx_http_upstream_create(r) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR
}

2. 设置模块的tag和schema。schema现在只会用于日志,tag会用于buf_chain管理。

u = r->upstream

ngx_str_set(&u->schema, "memcached://")
u->output.tag = (ngx_buf_tag_t) &ngx_http_memcached_module

3. 设置upstream的后端服务器列表数据结构。

mlcf = ngx_http_get_module_loc_conf(r, ngx_http_memcached_module)
u->conf = &mlcf->upstream

4. 设置upstream回调函数。在这里列出的代码稍稍调整了代码顺序。

u->create_request = ngx_http_memcached_create_request
u->reinit_request = ngx_http_memcached_reinit_request
u->process_header = ngx_http_memcached_process_header
u->abort_request = ngx_http_memcached_abort_request
u->finalize_request = ngx_http_memcached_finalize_request
u->input_filter_init = ngx_http_memcached_filter_init
u->input_filter = ngx_http_memcached_filter

5. 创建并设置upstream环境数据结构。

ctx = ngx_palloc(r->pool, sizeof(ngx_http_memcached_ctx_t))
if (ctx == NULL) {
return NGX_HTTP_INTERNAL_SERVER_ERROR
}

ctx->rest = NGX_HTTP_MEMCACHED_END
ctx->request = r

ngx_http_set_ctx(r, ctx, ngx_http_memcached_module)

u->input_filter_ctx = ctx

6. 完成upstream初始化并进行收尾工作。

r->main->count
ngx_http_upstream_init(r)
return NGX_DONE

nginx.conf配置的root目录要什么权限

你可以修改nginx配置里的root,比如下面的代码路径是到/data/www读取: server { listen 80 server_name test.abc.com root /data/www index index.php location ~ .php$ { fastcgi_pass 127.0.0.1:9000 fastcgi_index index.php fastcgi...

如何在客户端和服务端取环境变量

设置环境变量(修改PATH和TNS_ADMIN环境变量):
对于NLS_LANG环境变量, 最好设置成和数据库端一致, 首先从数据库端查询字符集信息:
如图,以system普通用户登陆就好,进去后新建一个SQL WINDOW,输入
SQL> select userenv(language) nls_lang from dual
我的电脑结果为
NLS_LANG
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK

右击"我的电脑" - "属性" - "高级" - "环境变量" - "系统环境变量":(win8.1系统,自己上网查怎么找出高级中的系统变量)
1>.选择"Path" - 点击"编辑", 把 "D:apporclproductinstantclient_12_1" 加入
2>.点击"新建", 变量名设置为"TNS_ADMIN", 变量值设置为"D:apporclproductinstantclient_12_1", 点击"确定"
3>.点击"新建", 变量名设置为"NLS_LANG", 变量值设置为"AMERICAN_AMERICA.ZHS16GBK", 点击"确定"
最后点击"确定"退出.
这样就全部结束了。

最新文章