Welcome! Log In Create A New Profile

Advanced

проблема с "hello world" модулем

August 06, 2010 11:08AM
Есть модуль под nginx который в общем-то ничего не делает.:):

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>

# include <string.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# include <limits.h>

typedef struct {
ngx_uint_t testtest;
} ngx_http_hello_world_conf_t;



static void* ngx_http_hello_world_create_conf(ngx_conf_t *cf);

static ngx_command_t ngx_http_hello_world_commands[] = {

{ ngx_string("testtest"),
NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_hello_world_conf_t, testtest),
NULL },
ngx_null_command
};

static ngx_http_module_t ngx_http_hello_world_module_ctx = {
NULL, /* preconfiguration */
NULL, /* postconfiguration */

NULL, /* create main configuration */
NULL, /* init main configuration */

NULL, /* create server configuration */
NULL, /* merge server configuration */
ngx_http_hello_world_create_conf,
NULL
};

ngx_module_t ngx_http_hello_world_module = {
NGX_MODULE_V1,
&ngx_http_hello_world_module_ctx, /* module context */
ngx_http_hello_world_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
NULL, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
NULL, /* exit process */
NULL, /* exit master */
NGX_MODULE_V1_PADDING
};

static void* ngx_http_hello_world_create_conf(ngx_conf_t *cf)
{
ngx_http_hello_world_conf_t *conf;

// conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_hello_world_conf_t));
// if (conf == NULL) {
// return NULL;
// }
// return conf;
}




И есть конфиг файл:
http {
include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;

location /test {
testtest 11;
return 404;
}

}


По идее для переменной testtest в данном случае должно присваиваться значение 11.

Но при запуске nginx возникает ошибка:
emerg]: "testtest" directive is duplicate in /usr/local/nginx//conf/nginx.conf:29

В чем может быть проблема ?



_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

проблема с "hello world" модулем

Bdfy August 06, 2010 11:08AM

Re: проблема с "hello world" модулем

Maxim Dounin August 07, 2010 04:42PM

Re: проблема с "hello world" модулем

Ildar May 12, 2011 02:56AM

Re: проблема с "hello world" модулем

Ildar May 12, 2011 03:25PM

Re: проблема с "hello world" модулем

jjjx128 May 12, 2011 07:11PM

Re: проблема с "hello world" модулем

Ildar May 13, 2011 12:43AM

Re: проблема с "hello world" модулем

vt May 12, 2011 08:24AM

Re: проблема с "hello world" модулем

Rush May 12, 2011 12:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 121
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready