mirror of
https://github.com/nginx/nginx.git
synced 2024-11-27 23:49:00 +08:00
nginx-0.1.0-2004-10-01-19:53:53 import
This commit is contained in:
parent
4bed15b9b5
commit
8035fd2791
6
auto/cc
6
auto/cc
@ -28,12 +28,6 @@ case $CC in
|
||||
# optimize for Pentium 4, gcc 3.x
|
||||
CPU_OPT="-march=pentium4"
|
||||
;;
|
||||
|
||||
sparc64)
|
||||
# build 64-bit binary, sparcv9 only
|
||||
CPU_OPT="-m64"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# STUB for batch builds
|
||||
|
@ -7,6 +7,7 @@ install:
|
||||
test -d $PREFIX || mkdir -p $PREFIX
|
||||
|
||||
test -d `dirname $SBIN_PATH` || mkdir -p `dirname $SBIN_PATH`
|
||||
test ! -f $SBIN_PATH || mv $SBIN_PATH $SBIN_PATH.old
|
||||
cp nginx $SBIN_PATH
|
||||
|
||||
test -d `dirname $CONF_PATH` || mkdir -p `dirname $CONF_PATH`
|
||||
|
@ -32,6 +32,14 @@ case $PLATFORM in
|
||||
|
||||
*:sun4u)
|
||||
CFLAGS="$CFLAGS -mcpu=v9"
|
||||
|
||||
if [ ".$CPU" = ".sparc64" ]; then
|
||||
CFLAGS="$CFLAGS -m64"
|
||||
CPU_OPT="-m64"
|
||||
CORE_LINK="$CORE_LINK -m64"
|
||||
|
||||
CC_TEST_FLAGS="$CC_TEST_FLAGS -mcpu=v9 -m64"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -118,7 +118,7 @@ int main(int argc, char *const *argv)
|
||||
|
||||
ngx_pid = ngx_getpid();
|
||||
|
||||
if (!(log = ngx_log_init_errlog())) {
|
||||
if (!(log = ngx_log_init_stderr())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -144,6 +144,14 @@ int main(int argc, char *const *argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ngx_test_config) {
|
||||
log->log_level = NGX_LOG_INFO;
|
||||
} else {
|
||||
if (ngx_log_init_error_log() == NGX_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ngx_os_init(log) == NGX_ERROR) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle)
|
||||
NGX_FILE_RDWR,
|
||||
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
log->log_level = NGX_LOG_DEBUG_ALL;
|
||||
#endif
|
||||
ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
|
||||
|
@ -224,11 +224,8 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
ngx_log_t *ngx_log_init_errlog()
|
||||
ngx_log_t *ngx_log_init_stderr()
|
||||
{
|
||||
ngx_fd_t fd;
|
||||
|
||||
#if (WIN32)
|
||||
|
||||
ngx_stderr.fd = GetStdHandle(STD_ERROR_HANDLE);
|
||||
@ -253,18 +250,25 @@ ngx_log_t *ngx_log_init_errlog()
|
||||
#endif
|
||||
|
||||
ngx_log.file = &ngx_stderr;
|
||||
ngx_log.log_level = NGX_LOG_ERR;
|
||||
|
||||
return &ngx_log;
|
||||
}
|
||||
|
||||
|
||||
ngx_int_t ngx_log_init_error_log()
|
||||
{
|
||||
ngx_fd_t fd;
|
||||
|
||||
#ifdef NGX_ERROR_LOG_PATH
|
||||
|
||||
ngx_log.log_level = NGX_LOG_ERR;
|
||||
|
||||
fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
|
||||
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
|
||||
|
||||
if (fd == NGX_INVALID_FILE) {
|
||||
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
|
||||
ngx_open_file_n " \"" NGX_ERROR_LOG_PATH "\" failed");
|
||||
return NULL;
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
#if (WIN32)
|
||||
@ -273,7 +277,7 @@ ngx_log_t *ngx_log_init_errlog()
|
||||
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
|
||||
ngx_file_append_mode_n " \"" NGX_ERROR_LOG_PATH
|
||||
"\" failed");
|
||||
return NULL;
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
#else
|
||||
@ -281,18 +285,18 @@ ngx_log_t *ngx_log_init_errlog()
|
||||
if (dup2(fd, STDERR_FILENO) == NGX_ERROR) {
|
||||
ngx_log_error(NGX_LOG_EMERG, (&ngx_log), ngx_errno,
|
||||
"dup2(STDERR) failed");
|
||||
return NULL;
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
#else /* no NGX_ERROR_LOG_PATH */
|
||||
|
||||
ngx_log.log_level = NGX_LOG_INFO;
|
||||
|
||||
#endif
|
||||
|
||||
return &ngx_log;
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -195,7 +195,8 @@ void ngx_assert_core(ngx_log_t *log, const char *fmt, ...);
|
||||
#define ngx_log_alloc_log(pool, log) ngx_palloc(pool, log, sizeof(ngx_log_t))
|
||||
#define ngx_log_copy_log(new, old) ngx_memcpy(new, old, sizeof(ngx_log_t))
|
||||
|
||||
ngx_log_t *ngx_log_init_errlog();
|
||||
ngx_log_t *ngx_log_init_stderr();
|
||||
ngx_int_t ngx_log_init_error_log();
|
||||
ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
|
||||
char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log);
|
||||
|
||||
|
@ -919,19 +919,19 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
|
||||
|
||||
ngx_conf_merge_msec_value(conf->connect_timeout,
|
||||
prev->connect_timeout, 60000);
|
||||
ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 30000);
|
||||
ngx_conf_merge_msec_value(conf->send_timeout, prev->send_timeout, 60000);
|
||||
|
||||
ngx_conf_merge_value(conf->preserve_host, prev->preserve_host, 0);
|
||||
ngx_conf_merge_value(conf->set_x_real_ip, prev->set_x_real_ip, 0);
|
||||
ngx_conf_merge_value(conf->add_x_forwarded_for,
|
||||
prev->add_x_forwarded_for, 0);
|
||||
|
||||
ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 30000);
|
||||
ngx_conf_merge_msec_value(conf->read_timeout, prev->read_timeout, 60000);
|
||||
|
||||
ngx_conf_merge_size_value(conf->header_buffer_size,
|
||||
prev->header_buffer_size, 4096);
|
||||
prev->header_buffer_size, (size_t) ngx_pagesize);
|
||||
|
||||
ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, 4096);
|
||||
ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 8, ngx_pagesize);
|
||||
|
||||
if (conf->bufs.num < 2) {
|
||||
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
||||
|
@ -1330,11 +1330,11 @@ static char *ngx_http_core_merge_srv_conf(ngx_conf_t *cf,
|
||||
}
|
||||
|
||||
ngx_conf_merge_size_value(conf->connection_pool_size,
|
||||
prev->connection_pool_size, 2048);
|
||||
prev->connection_pool_size, 256);
|
||||
ngx_conf_merge_msec_value(conf->post_accept_timeout,
|
||||
prev->post_accept_timeout, 30000);
|
||||
prev->post_accept_timeout, 60000);
|
||||
ngx_conf_merge_size_value(conf->request_pool_size,
|
||||
prev->request_pool_size, 16384);
|
||||
prev->request_pool_size, 4096);
|
||||
ngx_conf_merge_msec_value(conf->client_header_timeout,
|
||||
prev->client_header_timeout, 60000);
|
||||
ngx_conf_merge_size_value(conf->client_header_buffer_size,
|
||||
@ -1469,9 +1469,10 @@ static char *ngx_http_core_merge_loc_conf(ngx_conf_t *cf,
|
||||
prev->default_type, "text/plain");
|
||||
|
||||
ngx_conf_merge_size_value(conf->client_max_body_size,
|
||||
prev->client_max_body_size, 10 * 1024 * 1024);
|
||||
prev->client_max_body_size, 1 * 1024 * 1024);
|
||||
ngx_conf_merge_size_value(conf->client_body_buffer_size,
|
||||
prev->client_body_buffer_size, 8192);
|
||||
prev->client_body_buffer_size,
|
||||
(size_t) 2 * ngx_pagesize);
|
||||
ngx_conf_merge_msec_value(conf->client_body_timeout,
|
||||
prev->client_body_timeout, 60000);
|
||||
ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
|
||||
|
@ -549,10 +549,19 @@ static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
|
||||
ngx_err_t err;
|
||||
ngx_int_t n;
|
||||
ngx_uint_t i;
|
||||
struct timeval tv;
|
||||
ngx_listening_t *ls;
|
||||
ngx_core_conf_t *ccf;
|
||||
ngx_connection_t *c;
|
||||
|
||||
|
||||
ngx_gettimeofday(&tv);
|
||||
|
||||
ngx_start_msec = (ngx_epoch_msec_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
ngx_old_elapsed_msec = 0;
|
||||
ngx_elapsed_msec = 0;
|
||||
|
||||
|
||||
ngx_process = NGX_PROCESS_WORKER;
|
||||
|
||||
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
|
||||
|
Loading…
Reference in New Issue
Block a user