nginxtra 1.0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/bin/nginxtra +5 -0
- data/lib/nginxtra.rb +12 -0
- data/lib/nginxtra/action.rb +36 -0
- data/lib/nginxtra/actions/compile.rb +60 -0
- data/lib/nginxtra/actions/install.rb +99 -0
- data/lib/nginxtra/actions/reload.rb +14 -0
- data/lib/nginxtra/actions/restart.rb +15 -0
- data/lib/nginxtra/actions/start.rb +53 -0
- data/lib/nginxtra/actions/status.rb +31 -0
- data/lib/nginxtra/actions/stop.rb +14 -0
- data/lib/nginxtra/cli.rb +77 -0
- data/lib/nginxtra/config.rb +339 -0
- data/lib/nginxtra/error.rb +13 -0
- data/lib/nginxtra/status.rb +57 -0
- data/src/nginx/CHANGES +5630 -0
- data/src/nginx/CHANGES.ru +5716 -0
- data/src/nginx/LICENSE +25 -0
- data/src/nginx/README +3 -0
- data/src/nginx/auto/cc/acc +15 -0
- data/src/nginx/auto/cc/bcc +72 -0
- data/src/nginx/auto/cc/ccc +46 -0
- data/src/nginx/auto/cc/conf +189 -0
- data/src/nginx/auto/cc/gcc +183 -0
- data/src/nginx/auto/cc/icc +121 -0
- data/src/nginx/auto/cc/msvc +138 -0
- data/src/nginx/auto/cc/name +101 -0
- data/src/nginx/auto/cc/owc +104 -0
- data/src/nginx/auto/cc/sunc +158 -0
- data/src/nginx/auto/define +12 -0
- data/src/nginx/auto/endianess +45 -0
- data/src/nginx/auto/feature +123 -0
- data/src/nginx/auto/have +12 -0
- data/src/nginx/auto/have_headers +12 -0
- data/src/nginx/auto/headers +13 -0
- data/src/nginx/auto/include +61 -0
- data/src/nginx/auto/init +51 -0
- data/src/nginx/auto/install +184 -0
- data/src/nginx/auto/lib/conf +83 -0
- data/src/nginx/auto/lib/geoip/conf +79 -0
- data/src/nginx/auto/lib/google-perftools/conf +45 -0
- data/src/nginx/auto/lib/libatomic/conf +43 -0
- data/src/nginx/auto/lib/libatomic/make +14 -0
- data/src/nginx/auto/lib/libgd/conf +83 -0
- data/src/nginx/auto/lib/libxslt/conf +156 -0
- data/src/nginx/auto/lib/make +32 -0
- data/src/nginx/auto/lib/md5/conf +103 -0
- data/src/nginx/auto/lib/md5/make +96 -0
- data/src/nginx/auto/lib/md5/makefile.bcc +22 -0
- data/src/nginx/auto/lib/md5/makefile.msvc +22 -0
- data/src/nginx/auto/lib/md5/makefile.owc +11 -0
- data/src/nginx/auto/lib/openssl/conf +74 -0
- data/src/nginx/auto/lib/openssl/make +67 -0
- data/src/nginx/auto/lib/openssl/makefile.bcc +18 -0
- data/src/nginx/auto/lib/openssl/makefile.msvc +14 -0
- data/src/nginx/auto/lib/pcre/conf +180 -0
- data/src/nginx/auto/lib/pcre/make +64 -0
- data/src/nginx/auto/lib/pcre/makefile.bcc +26 -0
- data/src/nginx/auto/lib/pcre/makefile.msvc +22 -0
- data/src/nginx/auto/lib/pcre/makefile.owc +24 -0
- data/src/nginx/auto/lib/perl/conf +60 -0
- data/src/nginx/auto/lib/perl/make +36 -0
- data/src/nginx/auto/lib/sha1/conf +79 -0
- data/src/nginx/auto/lib/sha1/make +96 -0
- data/src/nginx/auto/lib/sha1/makefile.bcc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.msvc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.owc +11 -0
- data/src/nginx/auto/lib/test +40 -0
- data/src/nginx/auto/lib/zlib/conf +76 -0
- data/src/nginx/auto/lib/zlib/make +114 -0
- data/src/nginx/auto/lib/zlib/makefile.bcc +15 -0
- data/src/nginx/auto/lib/zlib/makefile.msvc +14 -0
- data/src/nginx/auto/lib/zlib/makefile.owc +14 -0
- data/src/nginx/auto/lib/zlib/patch.zlib.h +10 -0
- data/src/nginx/auto/make +417 -0
- data/src/nginx/auto/modules +479 -0
- data/src/nginx/auto/nohave +12 -0
- data/src/nginx/auto/options +490 -0
- data/src/nginx/auto/os/conf +105 -0
- data/src/nginx/auto/os/darwin +116 -0
- data/src/nginx/auto/os/freebsd +136 -0
- data/src/nginx/auto/os/linux +152 -0
- data/src/nginx/auto/os/solaris +60 -0
- data/src/nginx/auto/os/win32 +29 -0
- data/src/nginx/auto/sources +518 -0
- data/src/nginx/auto/stubs +8 -0
- data/src/nginx/auto/summary +114 -0
- data/src/nginx/auto/types/sizeof +83 -0
- data/src/nginx/auto/types/typedef +77 -0
- data/src/nginx/auto/types/uintptr_t +42 -0
- data/src/nginx/auto/types/value +12 -0
- data/src/nginx/auto/unix +719 -0
- data/src/nginx/conf/fastcgi.conf +24 -0
- data/src/nginx/conf/fastcgi_params +23 -0
- data/src/nginx/conf/koi-utf +109 -0
- data/src/nginx/conf/koi-win +103 -0
- data/src/nginx/conf/mime.types +80 -0
- data/src/nginx/conf/nginx.conf +118 -0
- data/src/nginx/conf/scgi_params +15 -0
- data/src/nginx/conf/uwsgi_params +15 -0
- data/src/nginx/conf/win-utf +126 -0
- data/src/nginx/configure +108 -0
- data/src/nginx/contrib/README +15 -0
- data/src/nginx/contrib/geo2nginx.pl +58 -0
- data/src/nginx/contrib/unicode2nginx/koi-utf +131 -0
- data/src/nginx/contrib/unicode2nginx/unicode-to-nginx.pl +45 -0
- data/src/nginx/contrib/unicode2nginx/win-utf +130 -0
- data/src/nginx/html/50x.html +18 -0
- data/src/nginx/html/index.html +8 -0
- data/src/nginx/man/nginx.8 +202 -0
- data/src/nginx/src/core/nginx.c +1333 -0
- data/src/nginx/src/core/nginx.h +20 -0
- data/src/nginx/src/core/ngx_array.c +147 -0
- data/src/nginx/src/core/ngx_array.h +53 -0
- data/src/nginx/src/core/ngx_buf.c +218 -0
- data/src/nginx/src/core/ngx_buf.h +162 -0
- data/src/nginx/src/core/ngx_conf_file.c +1506 -0
- data/src/nginx/src/core/ngx_conf_file.h +348 -0
- data/src/nginx/src/core/ngx_config.h +134 -0
- data/src/nginx/src/core/ngx_connection.c +1074 -0
- data/src/nginx/src/core/ngx_connection.h +195 -0
- data/src/nginx/src/core/ngx_core.h +95 -0
- data/src/nginx/src/core/ngx_cpuinfo.c +139 -0
- data/src/nginx/src/core/ngx_crc.h +39 -0
- data/src/nginx/src/core/ngx_crc32.c +129 -0
- data/src/nginx/src/core/ngx_crc32.h +79 -0
- data/src/nginx/src/core/ngx_crypt.c +238 -0
- data/src/nginx/src/core/ngx_crypt.h +20 -0
- data/src/nginx/src/core/ngx_cycle.c +1379 -0
- data/src/nginx/src/core/ngx_cycle.h +142 -0
- data/src/nginx/src/core/ngx_file.c +993 -0
- data/src/nginx/src/core/ngx_file.h +151 -0
- data/src/nginx/src/core/ngx_hash.c +976 -0
- data/src/nginx/src/core/ngx_hash.h +122 -0
- data/src/nginx/src/core/ngx_inet.c +1008 -0
- data/src/nginx/src/core/ngx_inet.h +120 -0
- data/src/nginx/src/core/ngx_list.c +71 -0
- data/src/nginx/src/core/ngx_list.h +83 -0
- data/src/nginx/src/core/ngx_log.c +459 -0
- data/src/nginx/src/core/ngx_log.h +250 -0
- data/src/nginx/src/core/ngx_md5.c +289 -0
- data/src/nginx/src/core/ngx_md5.h +60 -0
- data/src/nginx/src/core/ngx_murmurhash.c +50 -0
- data/src/nginx/src/core/ngx_murmurhash.h +19 -0
- data/src/nginx/src/core/ngx_open_file_cache.c +882 -0
- data/src/nginx/src/core/ngx_open_file_cache.h +119 -0
- data/src/nginx/src/core/ngx_output_chain.c +673 -0
- data/src/nginx/src/core/ngx_palloc.c +433 -0
- data/src/nginx/src/core/ngx_palloc.h +95 -0
- data/src/nginx/src/core/ngx_parse.c +249 -0
- data/src/nginx/src/core/ngx_parse.h +24 -0
- data/src/nginx/src/core/ngx_queue.c +80 -0
- data/src/nginx/src/core/ngx_queue.h +112 -0
- data/src/nginx/src/core/ngx_radix_tree.c +291 -0
- data/src/nginx/src/core/ngx_radix_tree.h +46 -0
- data/src/nginx/src/core/ngx_rbtree.c +383 -0
- data/src/nginx/src/core/ngx_rbtree.h +84 -0
- data/src/nginx/src/core/ngx_regex.c +206 -0
- data/src/nginx/src/core/ngx_regex.h +56 -0
- data/src/nginx/src/core/ngx_resolver.c +2201 -0
- data/src/nginx/src/core/ngx_resolver.h +149 -0
- data/src/nginx/src/core/ngx_sha1.h +31 -0
- data/src/nginx/src/core/ngx_shmtx.c +284 -0
- data/src/nginx/src/core/ngx_shmtx.h +38 -0
- data/src/nginx/src/core/ngx_slab.c +701 -0
- data/src/nginx/src/core/ngx_slab.h +54 -0
- data/src/nginx/src/core/ngx_spinlock.c +53 -0
- data/src/nginx/src/core/ngx_string.c +1837 -0
- data/src/nginx/src/core/ngx_string.h +231 -0
- data/src/nginx/src/core/ngx_times.c +407 -0
- data/src/nginx/src/core/ngx_times.h +51 -0
- data/src/nginx/src/event/modules/ngx_aio_module.c +171 -0
- data/src/nginx/src/event/modules/ngx_devpoll_module.c +569 -0
- data/src/nginx/src/event/modules/ngx_epoll_module.c +833 -0
- data/src/nginx/src/event/modules/ngx_eventport_module.c +602 -0
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +785 -0
- data/src/nginx/src/event/modules/ngx_poll_module.c +443 -0
- data/src/nginx/src/event/modules/ngx_rtsig_module.c +735 -0
- data/src/nginx/src/event/modules/ngx_select_module.c +435 -0
- data/src/nginx/src/event/modules/ngx_win32_select_module.c +400 -0
- data/src/nginx/src/event/ngx_event.c +1275 -0
- data/src/nginx/src/event/ngx_event.h +573 -0
- data/src/nginx/src/event/ngx_event_accept.c +428 -0
- data/src/nginx/src/event/ngx_event_busy_lock.c +286 -0
- data/src/nginx/src/event/ngx_event_busy_lock.h +65 -0
- data/src/nginx/src/event/ngx_event_connect.c +258 -0
- data/src/nginx/src/event/ngx_event_connect.h +76 -0
- data/src/nginx/src/event/ngx_event_mutex.c +70 -0
- data/src/nginx/src/event/ngx_event_openssl.c +2382 -0
- data/src/nginx/src/event/ngx_event_openssl.h +162 -0
- data/src/nginx/src/event/ngx_event_pipe.c +996 -0
- data/src/nginx/src/event/ngx_event_pipe.h +95 -0
- data/src/nginx/src/event/ngx_event_posted.c +173 -0
- data/src/nginx/src/event/ngx_event_posted.h +75 -0
- data/src/nginx/src/event/ngx_event_timer.c +159 -0
- data/src/nginx/src/event/ngx_event_timer.h +102 -0
- data/src/nginx/src/http/modules/ngx_http_access_module.c +384 -0
- data/src/nginx/src/http/modules/ngx_http_addition_filter_module.c +250 -0
- data/src/nginx/src/http/modules/ngx_http_auth_basic_module.c +478 -0
- data/src/nginx/src/http/modules/ngx_http_autoindex_module.c +701 -0
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +713 -0
- data/src/nginx/src/http/modules/ngx_http_charset_filter_module.c +1681 -0
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_dav_module.c +1141 -0
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +243 -0
- data/src/nginx/src/http/modules/ngx_http_empty_gif_module.c +140 -0
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +2916 -0
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +254 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +1441 -0
- data/src/nginx/src/http/modules/ngx_http_geoip_module.c +671 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +1206 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +299 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +616 -0
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1489 -0
- data/src/nginx/src/http/modules/ngx_http_index_module.c +516 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +809 -0
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +553 -0
- data/src/nginx/src/http/modules/ngx_http_log_module.c +1357 -0
- data/src/nginx/src/http/modules/ngx_http_map_module.c +575 -0
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +624 -0
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +3000 -0
- data/src/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +143 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +2831 -0
- data/src/nginx/src/http/modules/ngx_http_random_index_module.c +317 -0
- data/src/nginx/src/http/modules/ngx_http_range_filter_module.c +855 -0
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +476 -0
- data/src/nginx/src/http/modules/ngx_http_referer_module.c +613 -0
- data/src/nginx/src/http/modules/ngx_http_rewrite_module.c +1019 -0
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +1714 -0
- data/src/nginx/src/http/modules/ngx_http_secure_link_module.c +355 -0
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +2913 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.h +114 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.c +652 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.h +52 -0
- data/src/nginx/src/http/modules/ngx_http_static_module.c +278 -0
- data/src/nginx/src/http/modules/ngx_http_stub_status_module.c +144 -0
- data/src/nginx/src/http/modules/ngx_http_sub_filter_module.c +716 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +237 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +846 -0
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +1774 -0
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +984 -0
- data/src/nginx/src/http/modules/perl/Makefile.PL +42 -0
- data/src/nginx/src/http/modules/perl/nginx.pm +137 -0
- data/src/nginx/src/http/modules/perl/nginx.xs +986 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.c +1076 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.h +67 -0
- data/src/nginx/src/http/modules/perl/typemap +3 -0
- data/src/nginx/src/http/ngx_http.c +2073 -0
- data/src/nginx/src/http/ngx_http.h +160 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +307 -0
- data/src/nginx/src/http/ngx_http_busy_lock.h +54 -0
- data/src/nginx/src/http/ngx_http_cache.h +148 -0
- data/src/nginx/src/http/ngx_http_config.h +75 -0
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +300 -0
- data/src/nginx/src/http/ngx_http_core_module.c +4736 -0
- data/src/nginx/src/http/ngx_http_core_module.h +541 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +1715 -0
- data/src/nginx/src/http/ngx_http_header_filter_module.c +623 -0
- data/src/nginx/src/http/ngx_http_parse.c +1734 -0
- data/src/nginx/src/http/ngx_http_parse_time.c +276 -0
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +178 -0
- data/src/nginx/src/http/ngx_http_request.c +3181 -0
- data/src/nginx/src/http/ngx_http_request.h +573 -0
- data/src/nginx/src/http/ngx_http_request_body.c +644 -0
- data/src/nginx/src/http/ngx_http_script.c +1752 -0
- data/src/nginx/src/http/ngx_http_script.h +257 -0
- data/src/nginx/src/http/ngx_http_special_response.c +789 -0
- data/src/nginx/src/http/ngx_http_upstream.c +4555 -0
- data/src/nginx/src/http/ngx_http_upstream.h +350 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +791 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +85 -0
- data/src/nginx/src/http/ngx_http_variables.c +2053 -0
- data/src/nginx/src/http/ngx_http_variables.h +115 -0
- data/src/nginx/src/http/ngx_http_write_filter_module.c +315 -0
- data/src/nginx/src/mail/ngx_mail.c +542 -0
- data/src/nginx/src/mail/ngx_mail.h +407 -0
- data/src/nginx/src/mail/ngx_mail_auth_http_module.c +1452 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +553 -0
- data/src/nginx/src/mail/ngx_mail_handler.c +773 -0
- data/src/nginx/src/mail/ngx_mail_imap_handler.c +457 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.c +253 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.h +39 -0
- data/src/nginx/src/mail/ngx_mail_parse.c +885 -0
- data/src/nginx/src/mail/ngx_mail_pop3_handler.c +500 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.c +264 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.h +38 -0
- data/src/nginx/src/mail/ngx_mail_proxy_module.c +1089 -0
- data/src/nginx/src/mail/ngx_mail_smtp_handler.c +872 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.c +308 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.h +45 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.c +491 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.h +52 -0
- data/src/nginx/src/misc/ngx_cpp_test_module.cpp +27 -0
- data/src/nginx/src/misc/ngx_google_perftools_module.c +126 -0
- data/src/nginx/src/os/unix/ngx_aio_read.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_read_chain.c +78 -0
- data/src/nginx/src/os/unix/ngx_aio_write.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_write_chain.c +100 -0
- data/src/nginx/src/os/unix/ngx_alloc.c +90 -0
- data/src/nginx/src/os/unix/ngx_alloc.h +45 -0
- data/src/nginx/src/os/unix/ngx_atomic.h +311 -0
- data/src/nginx/src/os/unix/ngx_channel.c +258 -0
- data/src/nginx/src/os/unix/ngx_channel.h +34 -0
- data/src/nginx/src/os/unix/ngx_daemon.c +69 -0
- data/src/nginx/src/os/unix/ngx_darwin.h +20 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +96 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +166 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +366 -0
- data/src/nginx/src/os/unix/ngx_errno.c +87 -0
- data/src/nginx/src/os/unix/ngx_errno.h +68 -0
- data/src/nginx/src/os/unix/ngx_file_aio_read.c +208 -0
- data/src/nginx/src/os/unix/ngx_files.c +566 -0
- data/src/nginx/src/os/unix/ngx_files.h +343 -0
- data/src/nginx/src/os/unix/ngx_freebsd.h +24 -0
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +119 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +259 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +756 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +122 -0
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +436 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_amd64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_ppc.h +155 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_x86.h +127 -0
- data/src/nginx/src/os/unix/ngx_linux.h +18 -0
- data/src/nginx/src/os/unix/ngx_linux_aio_read.c +137 -0
- data/src/nginx/src/os/unix/ngx_linux_config.h +117 -0
- data/src/nginx/src/os/unix/ngx_linux_init.c +91 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +378 -0
- data/src/nginx/src/os/unix/ngx_os.h +84 -0
- data/src/nginx/src/os/unix/ngx_posix_config.h +153 -0
- data/src/nginx/src/os/unix/ngx_posix_init.c +124 -0
- data/src/nginx/src/os/unix/ngx_process.c +590 -0
- data/src/nginx/src/os/unix/ngx_process.h +87 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +1390 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.h +61 -0
- data/src/nginx/src/os/unix/ngx_pthread_thread.c +278 -0
- data/src/nginx/src/os/unix/ngx_readv_chain.c +258 -0
- data/src/nginx/src/os/unix/ngx_recv.c +180 -0
- data/src/nginx/src/os/unix/ngx_send.c +73 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +135 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.h +52 -0
- data/src/nginx/src/os/unix/ngx_shmem.c +126 -0
- data/src/nginx/src/os/unix/ngx_shmem.h +29 -0
- data/src/nginx/src/os/unix/ngx_socket.c +116 -0
- data/src/nginx/src/os/unix/ngx_socket.h +64 -0
- data/src/nginx/src/os/unix/ngx_solaris.h +16 -0
- data/src/nginx/src/os/unix/ngx_solaris_config.h +107 -0
- data/src/nginx/src/os/unix/ngx_solaris_init.c +75 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +251 -0
- data/src/nginx/src/os/unix/ngx_sunpro_amd64.il +43 -0
- data/src/nginx/src/os/unix/ngx_sunpro_atomic_sparc64.h +61 -0
- data/src/nginx/src/os/unix/ngx_sunpro_sparc64.il +36 -0
- data/src/nginx/src/os/unix/ngx_sunpro_x86.il +44 -0
- data/src/nginx/src/os/unix/ngx_thread.h +128 -0
- data/src/nginx/src/os/unix/ngx_time.c +104 -0
- data/src/nginx/src/os/unix/ngx_time.h +66 -0
- data/src/nginx/src/os/unix/ngx_udp_recv.c +115 -0
- data/src/nginx/src/os/unix/ngx_user.c +109 -0
- data/src/nginx/src/os/unix/ngx_user.h +24 -0
- data/src/nginx/src/os/unix/ngx_writev_chain.c +181 -0
- data/src/nginx/src/os/unix/rfork_thread.S +73 -0
- metadata +419 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/perl -w
|
2
|
+
|
3
|
+
# Convert unicode mappings to nginx configuration file format.
|
4
|
+
|
5
|
+
# You may find useful mappings in various places, including
|
6
|
+
# unicode.org official site:
|
7
|
+
#
|
8
|
+
# http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT
|
9
|
+
# http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT
|
10
|
+
|
11
|
+
# Needs perl 5.6 or later.
|
12
|
+
|
13
|
+
# Written by Maxim Dounin, mdounin@rambler-co.ru
|
14
|
+
|
15
|
+
###############################################################################
|
16
|
+
|
17
|
+
require 5.006;
|
18
|
+
|
19
|
+
while (<>) {
|
20
|
+
# Skip comments and empty lines
|
21
|
+
|
22
|
+
next if /^#/;
|
23
|
+
next if /^\s*$/;
|
24
|
+
chomp;
|
25
|
+
|
26
|
+
# Convert mappings
|
27
|
+
|
28
|
+
if (/^\s*0x(..)\s*0x(....)\s*(#.*)/) {
|
29
|
+
# Mapping <from-code> <unicode-code> "#" <unicode-name>
|
30
|
+
my $cs_code = $1;
|
31
|
+
my $un_code = $2;
|
32
|
+
my $un_name = $3;
|
33
|
+
|
34
|
+
# Produce UTF-8 sequence from character code;
|
35
|
+
|
36
|
+
my $un_utf8 = join('', map { sprintf("%02X", $_) } unpack("C*", pack("U", hex($un_code))));
|
37
|
+
|
38
|
+
print " $cs_code $un_utf8 ; $un_name\n";
|
39
|
+
|
40
|
+
} else {
|
41
|
+
warn "Unrecognized line: '$_'";
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
###############################################################################
|
@@ -0,0 +1,130 @@
|
|
1
|
+
charset_map windows-1251 utf-8 {
|
2
|
+
|
3
|
+
80 D082 ; #CYRILLIC CAPITAL LETTER DJE
|
4
|
+
81 D083 ; #CYRILLIC CAPITAL LETTER GJE
|
5
|
+
82 E2809A ; #SINGLE LOW-9 QUOTATION MARK
|
6
|
+
83 D193 ; #CYRILLIC SMALL LETTER GJE
|
7
|
+
84 E2809E ; #DOUBLE LOW-9 QUOTATION MARK
|
8
|
+
85 E280A6 ; #HORIZONTAL ELLIPSIS
|
9
|
+
86 E280A0 ; #DAGGER
|
10
|
+
87 E280A1 ; #DOUBLE DAGGER
|
11
|
+
88 E282AC ; #EURO SIGN
|
12
|
+
89 E280B0 ; #PER MILLE SIGN
|
13
|
+
8A D089 ; #CYRILLIC CAPITAL LETTER LJE
|
14
|
+
8B E280B9 ; #SINGLE LEFT-POINTING ANGLE QUOTATION MARK
|
15
|
+
8C D08A ; #CYRILLIC CAPITAL LETTER NJE
|
16
|
+
8D D08C ; #CYRILLIC CAPITAL LETTER KJE
|
17
|
+
8E D08B ; #CYRILLIC CAPITAL LETTER TSHE
|
18
|
+
8F D08F ; #CYRILLIC CAPITAL LETTER DZHE
|
19
|
+
90 D192 ; #CYRILLIC SMALL LETTER DJE
|
20
|
+
91 E28098 ; #LEFT SINGLE QUOTATION MARK
|
21
|
+
92 E28099 ; #RIGHT SINGLE QUOTATION MARK
|
22
|
+
93 E2809C ; #LEFT DOUBLE QUOTATION MARK
|
23
|
+
94 E2809D ; #RIGHT DOUBLE QUOTATION MARK
|
24
|
+
95 E280A2 ; #BULLET
|
25
|
+
96 E28093 ; #EN DASH
|
26
|
+
97 E28094 ; #EM DASH
|
27
|
+
99 E284A2 ; #TRADE MARK SIGN
|
28
|
+
9A D199 ; #CYRILLIC SMALL LETTER LJE
|
29
|
+
9B E280BA ; #SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
|
30
|
+
9C D19A ; #CYRILLIC SMALL LETTER NJE
|
31
|
+
9D D19C ; #CYRILLIC SMALL LETTER KJE
|
32
|
+
9E D19B ; #CYRILLIC SMALL LETTER TSHE
|
33
|
+
9F D19F ; #CYRILLIC SMALL LETTER DZHE
|
34
|
+
A0 C2A0 ; #NO-BREAK SPACE
|
35
|
+
A1 D08E ; #CYRILLIC CAPITAL LETTER SHORT U
|
36
|
+
A2 D19E ; #CYRILLIC SMALL LETTER SHORT U
|
37
|
+
A3 D088 ; #CYRILLIC CAPITAL LETTER JE
|
38
|
+
A4 C2A4 ; #CURRENCY SIGN
|
39
|
+
A5 D290 ; #CYRILLIC CAPITAL LETTER GHE WITH UPTURN
|
40
|
+
A6 C2A6 ; #BROKEN BAR
|
41
|
+
A7 C2A7 ; #SECTION SIGN
|
42
|
+
A8 D081 ; #CYRILLIC CAPITAL LETTER IO
|
43
|
+
A9 C2A9 ; #COPYRIGHT SIGN
|
44
|
+
AA D084 ; #CYRILLIC CAPITAL LETTER UKRAINIAN IE
|
45
|
+
AB C2AB ; #LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
|
46
|
+
AC C2AC ; #NOT SIGN
|
47
|
+
AD C2AD ; #SOFT HYPHEN
|
48
|
+
AE C2AE ; #REGISTERED SIGN
|
49
|
+
AF D087 ; #CYRILLIC CAPITAL LETTER YI
|
50
|
+
B0 C2B0 ; #DEGREE SIGN
|
51
|
+
B1 C2B1 ; #PLUS-MINUS SIGN
|
52
|
+
B2 D086 ; #CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
|
53
|
+
B3 D196 ; #CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
|
54
|
+
B4 D291 ; #CYRILLIC SMALL LETTER GHE WITH UPTURN
|
55
|
+
B5 C2B5 ; #MICRO SIGN
|
56
|
+
B6 C2B6 ; #PILCROW SIGN
|
57
|
+
B7 C2B7 ; #MIDDLE DOT
|
58
|
+
B8 D191 ; #CYRILLIC SMALL LETTER IO
|
59
|
+
B9 E28496 ; #NUMERO SIGN
|
60
|
+
BA D194 ; #CYRILLIC SMALL LETTER UKRAINIAN IE
|
61
|
+
BB C2BB ; #RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
|
62
|
+
BC D198 ; #CYRILLIC SMALL LETTER JE
|
63
|
+
BD D085 ; #CYRILLIC CAPITAL LETTER DZE
|
64
|
+
BE D195 ; #CYRILLIC SMALL LETTER DZE
|
65
|
+
BF D197 ; #CYRILLIC SMALL LETTER YI
|
66
|
+
C0 D090 ; #CYRILLIC CAPITAL LETTER A
|
67
|
+
C1 D091 ; #CYRILLIC CAPITAL LETTER BE
|
68
|
+
C2 D092 ; #CYRILLIC CAPITAL LETTER VE
|
69
|
+
C3 D093 ; #CYRILLIC CAPITAL LETTER GHE
|
70
|
+
C4 D094 ; #CYRILLIC CAPITAL LETTER DE
|
71
|
+
C5 D095 ; #CYRILLIC CAPITAL LETTER IE
|
72
|
+
C6 D096 ; #CYRILLIC CAPITAL LETTER ZHE
|
73
|
+
C7 D097 ; #CYRILLIC CAPITAL LETTER ZE
|
74
|
+
C8 D098 ; #CYRILLIC CAPITAL LETTER I
|
75
|
+
C9 D099 ; #CYRILLIC CAPITAL LETTER SHORT I
|
76
|
+
CA D09A ; #CYRILLIC CAPITAL LETTER KA
|
77
|
+
CB D09B ; #CYRILLIC CAPITAL LETTER EL
|
78
|
+
CC D09C ; #CYRILLIC CAPITAL LETTER EM
|
79
|
+
CD D09D ; #CYRILLIC CAPITAL LETTER EN
|
80
|
+
CE D09E ; #CYRILLIC CAPITAL LETTER O
|
81
|
+
CF D09F ; #CYRILLIC CAPITAL LETTER PE
|
82
|
+
D0 D0A0 ; #CYRILLIC CAPITAL LETTER ER
|
83
|
+
D1 D0A1 ; #CYRILLIC CAPITAL LETTER ES
|
84
|
+
D2 D0A2 ; #CYRILLIC CAPITAL LETTER TE
|
85
|
+
D3 D0A3 ; #CYRILLIC CAPITAL LETTER U
|
86
|
+
D4 D0A4 ; #CYRILLIC CAPITAL LETTER EF
|
87
|
+
D5 D0A5 ; #CYRILLIC CAPITAL LETTER HA
|
88
|
+
D6 D0A6 ; #CYRILLIC CAPITAL LETTER TSE
|
89
|
+
D7 D0A7 ; #CYRILLIC CAPITAL LETTER CHE
|
90
|
+
D8 D0A8 ; #CYRILLIC CAPITAL LETTER SHA
|
91
|
+
D9 D0A9 ; #CYRILLIC CAPITAL LETTER SHCHA
|
92
|
+
DA D0AA ; #CYRILLIC CAPITAL LETTER HARD SIGN
|
93
|
+
DB D0AB ; #CYRILLIC CAPITAL LETTER YERU
|
94
|
+
DC D0AC ; #CYRILLIC CAPITAL LETTER SOFT SIGN
|
95
|
+
DD D0AD ; #CYRILLIC CAPITAL LETTER E
|
96
|
+
DE D0AE ; #CYRILLIC CAPITAL LETTER YU
|
97
|
+
DF D0AF ; #CYRILLIC CAPITAL LETTER YA
|
98
|
+
E0 D0B0 ; #CYRILLIC SMALL LETTER A
|
99
|
+
E1 D0B1 ; #CYRILLIC SMALL LETTER BE
|
100
|
+
E2 D0B2 ; #CYRILLIC SMALL LETTER VE
|
101
|
+
E3 D0B3 ; #CYRILLIC SMALL LETTER GHE
|
102
|
+
E4 D0B4 ; #CYRILLIC SMALL LETTER DE
|
103
|
+
E5 D0B5 ; #CYRILLIC SMALL LETTER IE
|
104
|
+
E6 D0B6 ; #CYRILLIC SMALL LETTER ZHE
|
105
|
+
E7 D0B7 ; #CYRILLIC SMALL LETTER ZE
|
106
|
+
E8 D0B8 ; #CYRILLIC SMALL LETTER I
|
107
|
+
E9 D0B9 ; #CYRILLIC SMALL LETTER SHORT I
|
108
|
+
EA D0BA ; #CYRILLIC SMALL LETTER KA
|
109
|
+
EB D0BB ; #CYRILLIC SMALL LETTER EL
|
110
|
+
EC D0BC ; #CYRILLIC SMALL LETTER EM
|
111
|
+
ED D0BD ; #CYRILLIC SMALL LETTER EN
|
112
|
+
EE D0BE ; #CYRILLIC SMALL LETTER O
|
113
|
+
EF D0BF ; #CYRILLIC SMALL LETTER PE
|
114
|
+
F0 D180 ; #CYRILLIC SMALL LETTER ER
|
115
|
+
F1 D181 ; #CYRILLIC SMALL LETTER ES
|
116
|
+
F2 D182 ; #CYRILLIC SMALL LETTER TE
|
117
|
+
F3 D183 ; #CYRILLIC SMALL LETTER U
|
118
|
+
F4 D184 ; #CYRILLIC SMALL LETTER EF
|
119
|
+
F5 D185 ; #CYRILLIC SMALL LETTER HA
|
120
|
+
F6 D186 ; #CYRILLIC SMALL LETTER TSE
|
121
|
+
F7 D187 ; #CYRILLIC SMALL LETTER CHE
|
122
|
+
F8 D188 ; #CYRILLIC SMALL LETTER SHA
|
123
|
+
F9 D189 ; #CYRILLIC SMALL LETTER SHCHA
|
124
|
+
FA D18A ; #CYRILLIC SMALL LETTER HARD SIGN
|
125
|
+
FB D18B ; #CYRILLIC SMALL LETTER YERU
|
126
|
+
FC D18C ; #CYRILLIC SMALL LETTER SOFT SIGN
|
127
|
+
FD D18D ; #CYRILLIC SMALL LETTER E
|
128
|
+
FE D18E ; #CYRILLIC SMALL LETTER YU
|
129
|
+
FF D18F ; #CYRILLIC SMALL LETTER YA
|
130
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>The page is temporarily unavailable</title>
|
4
|
+
<style>
|
5
|
+
body { font-family: Tahoma, Verdana, Arial, sans-serif; }
|
6
|
+
</style>
|
7
|
+
</head>
|
8
|
+
<body bgcolor="white" text="black">
|
9
|
+
<table width="100%" height="100%">
|
10
|
+
<tr>
|
11
|
+
<td align="center" valign="middle">
|
12
|
+
The page you are looking for is temporarily unavailable.<br/>
|
13
|
+
Please try again later.
|
14
|
+
</td>
|
15
|
+
</tr>
|
16
|
+
</table>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,202 @@
|
|
1
|
+
.\"
|
2
|
+
.\" Copyright (c) 2010 Sergey A. Osokin
|
3
|
+
.\" Copyright (c) 2011,2012 Nginx, Inc.
|
4
|
+
.\" All rights reserved.
|
5
|
+
.\"
|
6
|
+
.\" Redistribution and use in source and binary forms, with or without
|
7
|
+
.\" modification, are permitted provided that the following conditions
|
8
|
+
.\" are met:
|
9
|
+
.\" 1. Redistributions of source code must retain the above copyright
|
10
|
+
.\" notice, this list of conditions and the following disclaimer.
|
11
|
+
.\" 2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
.\" notice, this list of conditions and the following disclaimer in the
|
13
|
+
.\" documentation and/or other materials provided with the distribution.
|
14
|
+
.\"
|
15
|
+
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
16
|
+
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17
|
+
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
18
|
+
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
19
|
+
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20
|
+
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
21
|
+
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22
|
+
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
23
|
+
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
24
|
+
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
.\" SUCH DAMAGE.
|
26
|
+
.\"
|
27
|
+
.\"
|
28
|
+
.Dd August 10, 2011
|
29
|
+
.Dt NGINX 8
|
30
|
+
.Os
|
31
|
+
.Sh NAME
|
32
|
+
.Nm nginx
|
33
|
+
.Nd "HTTP and reverse proxy server, mail proxy server"
|
34
|
+
.Sh SYNOPSIS
|
35
|
+
.Nm
|
36
|
+
.Op Fl hqtvV?
|
37
|
+
.Op Fl c Ar file
|
38
|
+
.Op Fl g Ar directives
|
39
|
+
.Op Fl p Ar prefix
|
40
|
+
.Op Fl s Ar signal
|
41
|
+
.Sh DESCRIPTION
|
42
|
+
The
|
43
|
+
.Nm
|
44
|
+
(spelled
|
45
|
+
.Dq engine x )
|
46
|
+
is an HTTP and reverse proxy server, as well as a mail proxy server.
|
47
|
+
The
|
48
|
+
.Nm
|
49
|
+
is known for its high performance, stability, rich feature set, simple
|
50
|
+
configuration, and low resource consumption.
|
51
|
+
.Pp
|
52
|
+
The options are as follows:
|
53
|
+
.Bl -tag -width ".Fl d Ar directives"
|
54
|
+
.It Fl ?\& | h
|
55
|
+
Print help.
|
56
|
+
.It Fl c Ar file
|
57
|
+
Use an alternative configuration
|
58
|
+
.Ar file .
|
59
|
+
.It Fl g Ar directives
|
60
|
+
Set global configuration directives.
|
61
|
+
See
|
62
|
+
.Sx EXAMPLES
|
63
|
+
for details.
|
64
|
+
.It Fl p Ar prefix
|
65
|
+
Set prefix path.
|
66
|
+
Default value is
|
67
|
+
.Pa %%PREFIX%% .
|
68
|
+
.It Fl q
|
69
|
+
Suppress non-error messages during configuration testing.
|
70
|
+
.It Fl s Ar signal
|
71
|
+
Send signal to the master process.
|
72
|
+
The argument
|
73
|
+
.Ar signal
|
74
|
+
can be one of:
|
75
|
+
.Cm stop , quit , reopen , reload .
|
76
|
+
The following table shows the corresponding system signals.
|
77
|
+
.Pp
|
78
|
+
.Bl -tag -width ".It Cm reopen" -compact
|
79
|
+
.It Cm stop
|
80
|
+
.Dv SIGTERM
|
81
|
+
.It Cm quit
|
82
|
+
.Dv SIGQUIT
|
83
|
+
.It Cm reopen
|
84
|
+
.Dv SIGUSR1
|
85
|
+
.It Cm reload
|
86
|
+
.Dv SIGHUP
|
87
|
+
.El
|
88
|
+
.It Fl t
|
89
|
+
Don't run, just test the configuration file.
|
90
|
+
The
|
91
|
+
.Nm
|
92
|
+
checks configuration for correct syntax and then tries to open files
|
93
|
+
referred in configuration.
|
94
|
+
.It Fl v
|
95
|
+
Print
|
96
|
+
.Nm
|
97
|
+
version.
|
98
|
+
.It Fl V
|
99
|
+
Print
|
100
|
+
.Nm
|
101
|
+
version, compiler version and
|
102
|
+
.Pa configure
|
103
|
+
script parameters.
|
104
|
+
.El
|
105
|
+
.Sh SIGNALS
|
106
|
+
The master process of
|
107
|
+
.Nm
|
108
|
+
can handle the following signals.
|
109
|
+
.Pp
|
110
|
+
.Bl -tag -width ".It Dv SIGINT , SIGTERM" -compact
|
111
|
+
.It Dv SIGINT , SIGTERM
|
112
|
+
Shut down quickly.
|
113
|
+
.It Dv SIGHUP
|
114
|
+
Reload configuration, start the new worker process with a new
|
115
|
+
configuration, gracefully shut down old worker processes.
|
116
|
+
.It Dv SIGQUIT
|
117
|
+
Shut down gracefully.
|
118
|
+
.It Dv SIGUSR1
|
119
|
+
Reopen log files.
|
120
|
+
.It Dv SIGUSR2
|
121
|
+
Upgrade
|
122
|
+
.Nm
|
123
|
+
executable on the fly.
|
124
|
+
.It Dv SIGWINCH
|
125
|
+
Shut down gracefully worker processes.
|
126
|
+
.El
|
127
|
+
.Pp
|
128
|
+
While there's no need to explicitly control worker processes normally,
|
129
|
+
they support some signals, too:
|
130
|
+
.Pp
|
131
|
+
.Bl -tag -width ".It Dv SIGINT , SIGTERM" -compact
|
132
|
+
.It Dv SIGTERM
|
133
|
+
Shut down quickly.
|
134
|
+
.It Dv SIGQUIT
|
135
|
+
Shut down gracefully.
|
136
|
+
.It Dv SIGUSR1
|
137
|
+
Reopen log files.
|
138
|
+
.El
|
139
|
+
.Sh DEBUGGING LOG
|
140
|
+
To enable a debugging log, reconfigure
|
141
|
+
.Nm
|
142
|
+
to build with debugging:
|
143
|
+
.Pp
|
144
|
+
.Dl "./configure --with-debug ..."
|
145
|
+
.Pp
|
146
|
+
and then set the
|
147
|
+
.Cm debug
|
148
|
+
level of the
|
149
|
+
.Va error_log :
|
150
|
+
.Pp
|
151
|
+
.Dl "error_log /path/to/log debug;"
|
152
|
+
.Pp
|
153
|
+
It is also possible to enable the debugging for some IP address:
|
154
|
+
.Bd -literal -offset indent
|
155
|
+
events {
|
156
|
+
debug_connection 127.0.0.1;
|
157
|
+
}
|
158
|
+
.Ed
|
159
|
+
.Sh FILES
|
160
|
+
.Bl -tag -width indent -compact
|
161
|
+
.It Pa %%PID_PATH%%
|
162
|
+
Contains the process ID of the
|
163
|
+
.Nm
|
164
|
+
listening for connections.
|
165
|
+
The content of this file is not sensitive; it can be world-readable.
|
166
|
+
.It Pa %%CONF_PATH%%
|
167
|
+
Main configuration file.
|
168
|
+
.It Pa %%ERROR_LOG_PATH%%
|
169
|
+
Error log file.
|
170
|
+
.El
|
171
|
+
.Sh EXIT STATUS
|
172
|
+
Exit status is 0 on success, or 1 if the command fails.
|
173
|
+
.Sh EXAMPLES
|
174
|
+
.Bd -literal
|
175
|
+
nginx -t -c ~/mynginx.conf -g "pid /var/run/mynginx.pid; worker_processes 2;"
|
176
|
+
.Ed
|
177
|
+
Test configuration file
|
178
|
+
.Pa ~/mynginx.conf
|
179
|
+
with global directives for PID and quantity of worker processes.
|
180
|
+
.Sh SEE ALSO
|
181
|
+
.\"Xr nginx.conf 5
|
182
|
+
.\"Pp
|
183
|
+
Documentation at
|
184
|
+
.Pa http://nginx.org/
|
185
|
+
and
|
186
|
+
.Pa http://sysoev.ru/nginx/ .
|
187
|
+
.Pp
|
188
|
+
For questions and technical support, please refer to
|
189
|
+
.Pa http://nginx.org/en/support.html .
|
190
|
+
.Sh HISTORY
|
191
|
+
Development of
|
192
|
+
.Nm
|
193
|
+
started in 2002, with the first public release on October 4, 2004.
|
194
|
+
.Sh AUTHORS
|
195
|
+
.An -nosplit
|
196
|
+
.An Igor Sysoev Aq igor@sysoev.ru
|
197
|
+
.Pp
|
198
|
+
This manual page was written by
|
199
|
+
.An Sergey A. Osokin Aq osa@FreeBSD.org.ru
|
200
|
+
as a result of compilation of many
|
201
|
+
.Nm
|
202
|
+
documents all over the world.
|
@@ -0,0 +1,1333 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <nginx.h>
|
11
|
+
|
12
|
+
|
13
|
+
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
|
14
|
+
static ngx_int_t ngx_get_options(int argc, char *const *argv);
|
15
|
+
static ngx_int_t ngx_process_options(ngx_cycle_t *cycle);
|
16
|
+
static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv);
|
17
|
+
static void *ngx_core_module_create_conf(ngx_cycle_t *cycle);
|
18
|
+
static char *ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf);
|
19
|
+
static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
20
|
+
static char *ngx_set_env(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
21
|
+
static char *ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
22
|
+
static char *ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd,
|
23
|
+
void *conf);
|
24
|
+
|
25
|
+
|
26
|
+
static ngx_conf_enum_t ngx_debug_points[] = {
|
27
|
+
{ ngx_string("stop"), NGX_DEBUG_POINTS_STOP },
|
28
|
+
{ ngx_string("abort"), NGX_DEBUG_POINTS_ABORT },
|
29
|
+
{ ngx_null_string, 0 }
|
30
|
+
};
|
31
|
+
|
32
|
+
|
33
|
+
static ngx_command_t ngx_core_commands[] = {
|
34
|
+
|
35
|
+
{ ngx_string("daemon"),
|
36
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_FLAG,
|
37
|
+
ngx_conf_set_flag_slot,
|
38
|
+
0,
|
39
|
+
offsetof(ngx_core_conf_t, daemon),
|
40
|
+
NULL },
|
41
|
+
|
42
|
+
{ ngx_string("master_process"),
|
43
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_FLAG,
|
44
|
+
ngx_conf_set_flag_slot,
|
45
|
+
0,
|
46
|
+
offsetof(ngx_core_conf_t, master),
|
47
|
+
NULL },
|
48
|
+
|
49
|
+
{ ngx_string("timer_resolution"),
|
50
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
51
|
+
ngx_conf_set_msec_slot,
|
52
|
+
0,
|
53
|
+
offsetof(ngx_core_conf_t, timer_resolution),
|
54
|
+
NULL },
|
55
|
+
|
56
|
+
{ ngx_string("pid"),
|
57
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
58
|
+
ngx_conf_set_str_slot,
|
59
|
+
0,
|
60
|
+
offsetof(ngx_core_conf_t, pid),
|
61
|
+
NULL },
|
62
|
+
|
63
|
+
{ ngx_string("lock_file"),
|
64
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
65
|
+
ngx_conf_set_str_slot,
|
66
|
+
0,
|
67
|
+
offsetof(ngx_core_conf_t, lock_file),
|
68
|
+
NULL },
|
69
|
+
|
70
|
+
{ ngx_string("worker_processes"),
|
71
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
72
|
+
ngx_conf_set_num_slot,
|
73
|
+
0,
|
74
|
+
offsetof(ngx_core_conf_t, worker_processes),
|
75
|
+
NULL },
|
76
|
+
|
77
|
+
{ ngx_string("debug_points"),
|
78
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
79
|
+
ngx_conf_set_enum_slot,
|
80
|
+
0,
|
81
|
+
offsetof(ngx_core_conf_t, debug_points),
|
82
|
+
&ngx_debug_points },
|
83
|
+
|
84
|
+
{ ngx_string("user"),
|
85
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE12,
|
86
|
+
ngx_set_user,
|
87
|
+
0,
|
88
|
+
0,
|
89
|
+
NULL },
|
90
|
+
|
91
|
+
{ ngx_string("worker_priority"),
|
92
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
93
|
+
ngx_set_priority,
|
94
|
+
0,
|
95
|
+
0,
|
96
|
+
NULL },
|
97
|
+
|
98
|
+
{ ngx_string("worker_cpu_affinity"),
|
99
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_1MORE,
|
100
|
+
ngx_set_cpu_affinity,
|
101
|
+
0,
|
102
|
+
0,
|
103
|
+
NULL },
|
104
|
+
|
105
|
+
{ ngx_string("worker_rlimit_nofile"),
|
106
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
107
|
+
ngx_conf_set_num_slot,
|
108
|
+
0,
|
109
|
+
offsetof(ngx_core_conf_t, rlimit_nofile),
|
110
|
+
NULL },
|
111
|
+
|
112
|
+
{ ngx_string("worker_rlimit_core"),
|
113
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
114
|
+
ngx_conf_set_off_slot,
|
115
|
+
0,
|
116
|
+
offsetof(ngx_core_conf_t, rlimit_core),
|
117
|
+
NULL },
|
118
|
+
|
119
|
+
{ ngx_string("worker_rlimit_sigpending"),
|
120
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
121
|
+
ngx_conf_set_num_slot,
|
122
|
+
0,
|
123
|
+
offsetof(ngx_core_conf_t, rlimit_sigpending),
|
124
|
+
NULL },
|
125
|
+
|
126
|
+
{ ngx_string("working_directory"),
|
127
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
128
|
+
ngx_conf_set_str_slot,
|
129
|
+
0,
|
130
|
+
offsetof(ngx_core_conf_t, working_directory),
|
131
|
+
NULL },
|
132
|
+
|
133
|
+
{ ngx_string("env"),
|
134
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
135
|
+
ngx_set_env,
|
136
|
+
0,
|
137
|
+
0,
|
138
|
+
NULL },
|
139
|
+
|
140
|
+
#if (NGX_THREADS)
|
141
|
+
|
142
|
+
{ ngx_string("worker_threads"),
|
143
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
144
|
+
ngx_conf_set_num_slot,
|
145
|
+
0,
|
146
|
+
offsetof(ngx_core_conf_t, worker_threads),
|
147
|
+
NULL },
|
148
|
+
|
149
|
+
{ ngx_string("thread_stack_size"),
|
150
|
+
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
|
151
|
+
ngx_conf_set_size_slot,
|
152
|
+
0,
|
153
|
+
offsetof(ngx_core_conf_t, thread_stack_size),
|
154
|
+
NULL },
|
155
|
+
|
156
|
+
#endif
|
157
|
+
|
158
|
+
ngx_null_command
|
159
|
+
};
|
160
|
+
|
161
|
+
|
162
|
+
static ngx_core_module_t ngx_core_module_ctx = {
|
163
|
+
ngx_string("core"),
|
164
|
+
ngx_core_module_create_conf,
|
165
|
+
ngx_core_module_init_conf
|
166
|
+
};
|
167
|
+
|
168
|
+
|
169
|
+
ngx_module_t ngx_core_module = {
|
170
|
+
NGX_MODULE_V1,
|
171
|
+
&ngx_core_module_ctx, /* module context */
|
172
|
+
ngx_core_commands, /* module directives */
|
173
|
+
NGX_CORE_MODULE, /* module type */
|
174
|
+
NULL, /* init master */
|
175
|
+
NULL, /* init module */
|
176
|
+
NULL, /* init process */
|
177
|
+
NULL, /* init thread */
|
178
|
+
NULL, /* exit thread */
|
179
|
+
NULL, /* exit process */
|
180
|
+
NULL, /* exit master */
|
181
|
+
NGX_MODULE_V1_PADDING
|
182
|
+
};
|
183
|
+
|
184
|
+
|
185
|
+
ngx_uint_t ngx_max_module;
|
186
|
+
|
187
|
+
static ngx_uint_t ngx_show_help;
|
188
|
+
static ngx_uint_t ngx_show_version;
|
189
|
+
static ngx_uint_t ngx_show_configure;
|
190
|
+
static u_char *ngx_prefix;
|
191
|
+
static u_char *ngx_conf_file;
|
192
|
+
static u_char *ngx_conf_params;
|
193
|
+
static char *ngx_signal;
|
194
|
+
|
195
|
+
|
196
|
+
static char **ngx_os_environ;
|
197
|
+
|
198
|
+
|
199
|
+
int ngx_cdecl
|
200
|
+
main(int argc, char *const *argv)
|
201
|
+
{
|
202
|
+
ngx_int_t i;
|
203
|
+
ngx_log_t *log;
|
204
|
+
ngx_cycle_t *cycle, init_cycle;
|
205
|
+
ngx_core_conf_t *ccf;
|
206
|
+
|
207
|
+
#if (NGX_FREEBSD)
|
208
|
+
ngx_debug_init();
|
209
|
+
#endif
|
210
|
+
|
211
|
+
if (ngx_strerror_init() != NGX_OK) {
|
212
|
+
return 1;
|
213
|
+
}
|
214
|
+
|
215
|
+
if (ngx_get_options(argc, argv) != NGX_OK) {
|
216
|
+
return 1;
|
217
|
+
}
|
218
|
+
|
219
|
+
if (ngx_show_version) {
|
220
|
+
ngx_write_stderr("nginx version: " NGINX_VER NGX_LINEFEED);
|
221
|
+
|
222
|
+
if (ngx_show_help) {
|
223
|
+
ngx_write_stderr(
|
224
|
+
"Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
|
225
|
+
"[-p prefix] [-g directives]" NGX_LINEFEED
|
226
|
+
NGX_LINEFEED
|
227
|
+
"Options:" NGX_LINEFEED
|
228
|
+
" -?,-h : this help" NGX_LINEFEED
|
229
|
+
" -v : show version and exit" NGX_LINEFEED
|
230
|
+
" -V : show version and configure options then exit"
|
231
|
+
NGX_LINEFEED
|
232
|
+
" -t : test configuration and exit" NGX_LINEFEED
|
233
|
+
" -q : suppress non-error messages "
|
234
|
+
"during configuration testing" NGX_LINEFEED
|
235
|
+
" -s signal : send signal to a master process: "
|
236
|
+
"stop, quit, reopen, reload" NGX_LINEFEED
|
237
|
+
#ifdef NGX_PREFIX
|
238
|
+
" -p prefix : set prefix path (default: "
|
239
|
+
NGX_PREFIX ")" NGX_LINEFEED
|
240
|
+
#else
|
241
|
+
" -p prefix : set prefix path (default: NONE)" NGX_LINEFEED
|
242
|
+
#endif
|
243
|
+
" -c filename : set configuration file (default: "
|
244
|
+
NGX_CONF_PATH ")" NGX_LINEFEED
|
245
|
+
" -g directives : set global directives out of configuration "
|
246
|
+
"file" NGX_LINEFEED NGX_LINEFEED
|
247
|
+
);
|
248
|
+
}
|
249
|
+
|
250
|
+
if (ngx_show_configure) {
|
251
|
+
ngx_write_stderr(
|
252
|
+
#ifdef NGX_COMPILER
|
253
|
+
"built by " NGX_COMPILER NGX_LINEFEED
|
254
|
+
#endif
|
255
|
+
#if (NGX_SSL)
|
256
|
+
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
|
257
|
+
"TLS SNI support enabled" NGX_LINEFEED
|
258
|
+
#else
|
259
|
+
"TLS SNI support disabled" NGX_LINEFEED
|
260
|
+
#endif
|
261
|
+
#endif
|
262
|
+
"configure arguments:" NGX_CONFIGURE NGX_LINEFEED);
|
263
|
+
}
|
264
|
+
|
265
|
+
if (!ngx_test_config) {
|
266
|
+
return 0;
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
/* TODO */ ngx_max_sockets = -1;
|
271
|
+
|
272
|
+
ngx_time_init();
|
273
|
+
|
274
|
+
#if (NGX_PCRE)
|
275
|
+
ngx_regex_init();
|
276
|
+
#endif
|
277
|
+
|
278
|
+
ngx_pid = ngx_getpid();
|
279
|
+
|
280
|
+
log = ngx_log_init(ngx_prefix);
|
281
|
+
if (log == NULL) {
|
282
|
+
return 1;
|
283
|
+
}
|
284
|
+
|
285
|
+
/* STUB */
|
286
|
+
#if (NGX_OPENSSL)
|
287
|
+
ngx_ssl_init(log);
|
288
|
+
#endif
|
289
|
+
|
290
|
+
/*
|
291
|
+
* init_cycle->log is required for signal handlers and
|
292
|
+
* ngx_process_options()
|
293
|
+
*/
|
294
|
+
|
295
|
+
ngx_memzero(&init_cycle, sizeof(ngx_cycle_t));
|
296
|
+
init_cycle.log = log;
|
297
|
+
ngx_cycle = &init_cycle;
|
298
|
+
|
299
|
+
init_cycle.pool = ngx_create_pool(1024, log);
|
300
|
+
if (init_cycle.pool == NULL) {
|
301
|
+
return 1;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (ngx_save_argv(&init_cycle, argc, argv) != NGX_OK) {
|
305
|
+
return 1;
|
306
|
+
}
|
307
|
+
|
308
|
+
if (ngx_process_options(&init_cycle) != NGX_OK) {
|
309
|
+
return 1;
|
310
|
+
}
|
311
|
+
|
312
|
+
if (ngx_os_init(log) != NGX_OK) {
|
313
|
+
return 1;
|
314
|
+
}
|
315
|
+
|
316
|
+
/*
|
317
|
+
* ngx_crc32_table_init() requires ngx_cacheline_size set in ngx_os_init()
|
318
|
+
*/
|
319
|
+
|
320
|
+
if (ngx_crc32_table_init() != NGX_OK) {
|
321
|
+
return 1;
|
322
|
+
}
|
323
|
+
|
324
|
+
if (ngx_add_inherited_sockets(&init_cycle) != NGX_OK) {
|
325
|
+
return 1;
|
326
|
+
}
|
327
|
+
|
328
|
+
ngx_max_module = 0;
|
329
|
+
for (i = 0; ngx_modules[i]; i++) {
|
330
|
+
ngx_modules[i]->index = ngx_max_module++;
|
331
|
+
}
|
332
|
+
|
333
|
+
cycle = ngx_init_cycle(&init_cycle);
|
334
|
+
if (cycle == NULL) {
|
335
|
+
if (ngx_test_config) {
|
336
|
+
ngx_log_stderr(0, "configuration file %s test failed",
|
337
|
+
init_cycle.conf_file.data);
|
338
|
+
}
|
339
|
+
|
340
|
+
return 1;
|
341
|
+
}
|
342
|
+
|
343
|
+
if (ngx_test_config) {
|
344
|
+
if (!ngx_quiet_mode) {
|
345
|
+
ngx_log_stderr(0, "configuration file %s test is successful",
|
346
|
+
cycle->conf_file.data);
|
347
|
+
}
|
348
|
+
|
349
|
+
return 0;
|
350
|
+
}
|
351
|
+
|
352
|
+
if (ngx_signal) {
|
353
|
+
return ngx_signal_process(cycle, ngx_signal);
|
354
|
+
}
|
355
|
+
|
356
|
+
ngx_os_status(cycle->log);
|
357
|
+
|
358
|
+
ngx_cycle = cycle;
|
359
|
+
|
360
|
+
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
|
361
|
+
|
362
|
+
if (ccf->master && ngx_process == NGX_PROCESS_SINGLE) {
|
363
|
+
ngx_process = NGX_PROCESS_MASTER;
|
364
|
+
}
|
365
|
+
|
366
|
+
#if !(NGX_WIN32)
|
367
|
+
|
368
|
+
if (ngx_init_signals(cycle->log) != NGX_OK) {
|
369
|
+
return 1;
|
370
|
+
}
|
371
|
+
|
372
|
+
if (!ngx_inherited && ccf->daemon) {
|
373
|
+
if (ngx_daemon(cycle->log) != NGX_OK) {
|
374
|
+
return 1;
|
375
|
+
}
|
376
|
+
|
377
|
+
ngx_daemonized = 1;
|
378
|
+
}
|
379
|
+
|
380
|
+
if (ngx_inherited) {
|
381
|
+
ngx_daemonized = 1;
|
382
|
+
}
|
383
|
+
|
384
|
+
#endif
|
385
|
+
|
386
|
+
if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
|
387
|
+
return 1;
|
388
|
+
}
|
389
|
+
|
390
|
+
if (cycle->log->file->fd != ngx_stderr) {
|
391
|
+
|
392
|
+
if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
|
393
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
394
|
+
ngx_set_stderr_n " failed");
|
395
|
+
return 1;
|
396
|
+
}
|
397
|
+
}
|
398
|
+
|
399
|
+
if (log->file->fd != ngx_stderr) {
|
400
|
+
if (ngx_close_file(log->file->fd) == NGX_FILE_ERROR) {
|
401
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
402
|
+
ngx_close_file_n " built-in log failed");
|
403
|
+
}
|
404
|
+
}
|
405
|
+
|
406
|
+
ngx_use_stderr = 0;
|
407
|
+
|
408
|
+
if (ngx_process == NGX_PROCESS_SINGLE) {
|
409
|
+
ngx_single_process_cycle(cycle);
|
410
|
+
|
411
|
+
} else {
|
412
|
+
ngx_master_process_cycle(cycle);
|
413
|
+
}
|
414
|
+
|
415
|
+
return 0;
|
416
|
+
}
|
417
|
+
|
418
|
+
|
419
|
+
static ngx_int_t
|
420
|
+
ngx_add_inherited_sockets(ngx_cycle_t *cycle)
|
421
|
+
{
|
422
|
+
u_char *p, *v, *inherited;
|
423
|
+
ngx_int_t s;
|
424
|
+
ngx_listening_t *ls;
|
425
|
+
|
426
|
+
inherited = (u_char *) getenv(NGINX_VAR);
|
427
|
+
|
428
|
+
if (inherited == NULL) {
|
429
|
+
return NGX_OK;
|
430
|
+
}
|
431
|
+
|
432
|
+
ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
|
433
|
+
"using inherited sockets from \"%s\"", inherited);
|
434
|
+
|
435
|
+
if (ngx_array_init(&cycle->listening, cycle->pool, 10,
|
436
|
+
sizeof(ngx_listening_t))
|
437
|
+
!= NGX_OK)
|
438
|
+
{
|
439
|
+
return NGX_ERROR;
|
440
|
+
}
|
441
|
+
|
442
|
+
for (p = inherited, v = p; *p; p++) {
|
443
|
+
if (*p == ':' || *p == ';') {
|
444
|
+
s = ngx_atoi(v, p - v);
|
445
|
+
if (s == NGX_ERROR) {
|
446
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
|
447
|
+
"invalid socket number \"%s\" in " NGINX_VAR
|
448
|
+
" environment variable, ignoring the rest"
|
449
|
+
" of the variable", v);
|
450
|
+
break;
|
451
|
+
}
|
452
|
+
|
453
|
+
v = p + 1;
|
454
|
+
|
455
|
+
ls = ngx_array_push(&cycle->listening);
|
456
|
+
if (ls == NULL) {
|
457
|
+
return NGX_ERROR;
|
458
|
+
}
|
459
|
+
|
460
|
+
ngx_memzero(ls, sizeof(ngx_listening_t));
|
461
|
+
|
462
|
+
ls->fd = (ngx_socket_t) s;
|
463
|
+
}
|
464
|
+
}
|
465
|
+
|
466
|
+
ngx_inherited = 1;
|
467
|
+
|
468
|
+
return ngx_set_inherited_sockets(cycle);
|
469
|
+
}
|
470
|
+
|
471
|
+
|
472
|
+
char **
|
473
|
+
ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last)
|
474
|
+
{
|
475
|
+
char **p, **env;
|
476
|
+
ngx_str_t *var;
|
477
|
+
ngx_uint_t i, n;
|
478
|
+
ngx_core_conf_t *ccf;
|
479
|
+
|
480
|
+
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
|
481
|
+
|
482
|
+
if (last == NULL && ccf->environment) {
|
483
|
+
return ccf->environment;
|
484
|
+
}
|
485
|
+
|
486
|
+
var = ccf->env.elts;
|
487
|
+
|
488
|
+
for (i = 0; i < ccf->env.nelts; i++) {
|
489
|
+
if (ngx_strcmp(var[i].data, "TZ") == 0
|
490
|
+
|| ngx_strncmp(var[i].data, "TZ=", 3) == 0)
|
491
|
+
{
|
492
|
+
goto tz_found;
|
493
|
+
}
|
494
|
+
}
|
495
|
+
|
496
|
+
var = ngx_array_push(&ccf->env);
|
497
|
+
if (var == NULL) {
|
498
|
+
return NULL;
|
499
|
+
}
|
500
|
+
|
501
|
+
var->len = 2;
|
502
|
+
var->data = (u_char *) "TZ";
|
503
|
+
|
504
|
+
var = ccf->env.elts;
|
505
|
+
|
506
|
+
tz_found:
|
507
|
+
|
508
|
+
n = 0;
|
509
|
+
|
510
|
+
for (i = 0; i < ccf->env.nelts; i++) {
|
511
|
+
|
512
|
+
if (var[i].data[var[i].len] == '=') {
|
513
|
+
n++;
|
514
|
+
continue;
|
515
|
+
}
|
516
|
+
|
517
|
+
for (p = ngx_os_environ; *p; p++) {
|
518
|
+
|
519
|
+
if (ngx_strncmp(*p, var[i].data, var[i].len) == 0
|
520
|
+
&& (*p)[var[i].len] == '=')
|
521
|
+
{
|
522
|
+
n++;
|
523
|
+
break;
|
524
|
+
}
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
528
|
+
if (last) {
|
529
|
+
env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log);
|
530
|
+
*last = n;
|
531
|
+
|
532
|
+
} else {
|
533
|
+
env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *));
|
534
|
+
}
|
535
|
+
|
536
|
+
if (env == NULL) {
|
537
|
+
return NULL;
|
538
|
+
}
|
539
|
+
|
540
|
+
n = 0;
|
541
|
+
|
542
|
+
for (i = 0; i < ccf->env.nelts; i++) {
|
543
|
+
|
544
|
+
if (var[i].data[var[i].len] == '=') {
|
545
|
+
env[n++] = (char *) var[i].data;
|
546
|
+
continue;
|
547
|
+
}
|
548
|
+
|
549
|
+
for (p = ngx_os_environ; *p; p++) {
|
550
|
+
|
551
|
+
if (ngx_strncmp(*p, var[i].data, var[i].len) == 0
|
552
|
+
&& (*p)[var[i].len] == '=')
|
553
|
+
{
|
554
|
+
env[n++] = *p;
|
555
|
+
break;
|
556
|
+
}
|
557
|
+
}
|
558
|
+
}
|
559
|
+
|
560
|
+
env[n] = NULL;
|
561
|
+
|
562
|
+
if (last == NULL) {
|
563
|
+
ccf->environment = env;
|
564
|
+
environ = env;
|
565
|
+
}
|
566
|
+
|
567
|
+
return env;
|
568
|
+
}
|
569
|
+
|
570
|
+
|
571
|
+
ngx_pid_t
|
572
|
+
ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
|
573
|
+
{
|
574
|
+
char **env, *var;
|
575
|
+
u_char *p;
|
576
|
+
ngx_uint_t i, n;
|
577
|
+
ngx_pid_t pid;
|
578
|
+
ngx_exec_ctx_t ctx;
|
579
|
+
ngx_core_conf_t *ccf;
|
580
|
+
ngx_listening_t *ls;
|
581
|
+
|
582
|
+
ngx_memzero(&ctx, sizeof(ngx_exec_ctx_t));
|
583
|
+
|
584
|
+
ctx.path = argv[0];
|
585
|
+
ctx.name = "new binary process";
|
586
|
+
ctx.argv = argv;
|
587
|
+
|
588
|
+
n = 2;
|
589
|
+
env = ngx_set_environment(cycle, &n);
|
590
|
+
if (env == NULL) {
|
591
|
+
return NGX_INVALID_PID;
|
592
|
+
}
|
593
|
+
|
594
|
+
var = ngx_alloc(sizeof(NGINX_VAR)
|
595
|
+
+ cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
|
596
|
+
cycle->log);
|
597
|
+
|
598
|
+
p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
|
599
|
+
|
600
|
+
ls = cycle->listening.elts;
|
601
|
+
for (i = 0; i < cycle->listening.nelts; i++) {
|
602
|
+
p = ngx_sprintf(p, "%ud;", ls[i].fd);
|
603
|
+
}
|
604
|
+
|
605
|
+
*p = '\0';
|
606
|
+
|
607
|
+
env[n++] = var;
|
608
|
+
|
609
|
+
#if (NGX_SETPROCTITLE_USES_ENV)
|
610
|
+
|
611
|
+
/* allocate the spare 300 bytes for the new binary process title */
|
612
|
+
|
613
|
+
env[n++] = "SPARE=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
614
|
+
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
615
|
+
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
616
|
+
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
617
|
+
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
|
618
|
+
|
619
|
+
#endif
|
620
|
+
|
621
|
+
env[n] = NULL;
|
622
|
+
|
623
|
+
#if (NGX_DEBUG)
|
624
|
+
{
|
625
|
+
char **e;
|
626
|
+
for (e = env; *e; e++) {
|
627
|
+
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cycle->log, 0, "env: %s", *e);
|
628
|
+
}
|
629
|
+
}
|
630
|
+
#endif
|
631
|
+
|
632
|
+
ctx.envp = (char *const *) env;
|
633
|
+
|
634
|
+
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
|
635
|
+
|
636
|
+
if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) != NGX_OK) {
|
637
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
638
|
+
ngx_rename_file_n " %s to %s failed "
|
639
|
+
"before executing new binary process \"%s\"",
|
640
|
+
ccf->pid.data, ccf->oldpid.data, argv[0]);
|
641
|
+
|
642
|
+
ngx_free(env);
|
643
|
+
ngx_free(var);
|
644
|
+
|
645
|
+
return NGX_INVALID_PID;
|
646
|
+
}
|
647
|
+
|
648
|
+
pid = ngx_execute(cycle, &ctx);
|
649
|
+
|
650
|
+
if (pid == NGX_INVALID_PID) {
|
651
|
+
if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data) != NGX_OK) {
|
652
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
653
|
+
ngx_rename_file_n " %s back to %s failed after "
|
654
|
+
"the try to execute the new binary process \"%s\"",
|
655
|
+
ccf->oldpid.data, ccf->pid.data, argv[0]);
|
656
|
+
}
|
657
|
+
}
|
658
|
+
|
659
|
+
ngx_free(env);
|
660
|
+
ngx_free(var);
|
661
|
+
|
662
|
+
return pid;
|
663
|
+
}
|
664
|
+
|
665
|
+
|
666
|
+
static ngx_int_t
|
667
|
+
ngx_get_options(int argc, char *const *argv)
|
668
|
+
{
|
669
|
+
u_char *p;
|
670
|
+
ngx_int_t i;
|
671
|
+
|
672
|
+
for (i = 1; i < argc; i++) {
|
673
|
+
|
674
|
+
p = (u_char *) argv[i];
|
675
|
+
|
676
|
+
if (*p++ != '-') {
|
677
|
+
ngx_log_stderr(0, "invalid option: \"%s\"", argv[i]);
|
678
|
+
return NGX_ERROR;
|
679
|
+
}
|
680
|
+
|
681
|
+
while (*p) {
|
682
|
+
|
683
|
+
switch (*p++) {
|
684
|
+
|
685
|
+
case '?':
|
686
|
+
case 'h':
|
687
|
+
ngx_show_version = 1;
|
688
|
+
ngx_show_help = 1;
|
689
|
+
break;
|
690
|
+
|
691
|
+
case 'v':
|
692
|
+
ngx_show_version = 1;
|
693
|
+
break;
|
694
|
+
|
695
|
+
case 'V':
|
696
|
+
ngx_show_version = 1;
|
697
|
+
ngx_show_configure = 1;
|
698
|
+
break;
|
699
|
+
|
700
|
+
case 't':
|
701
|
+
ngx_test_config = 1;
|
702
|
+
break;
|
703
|
+
|
704
|
+
case 'q':
|
705
|
+
ngx_quiet_mode = 1;
|
706
|
+
break;
|
707
|
+
|
708
|
+
case 'p':
|
709
|
+
if (*p) {
|
710
|
+
ngx_prefix = p;
|
711
|
+
goto next;
|
712
|
+
}
|
713
|
+
|
714
|
+
if (argv[++i]) {
|
715
|
+
ngx_prefix = (u_char *) argv[i];
|
716
|
+
goto next;
|
717
|
+
}
|
718
|
+
|
719
|
+
ngx_log_stderr(0, "option \"-p\" requires directory name");
|
720
|
+
return NGX_ERROR;
|
721
|
+
|
722
|
+
case 'c':
|
723
|
+
if (*p) {
|
724
|
+
ngx_conf_file = p;
|
725
|
+
goto next;
|
726
|
+
}
|
727
|
+
|
728
|
+
if (argv[++i]) {
|
729
|
+
ngx_conf_file = (u_char *) argv[i];
|
730
|
+
goto next;
|
731
|
+
}
|
732
|
+
|
733
|
+
ngx_log_stderr(0, "option \"-c\" requires file name");
|
734
|
+
return NGX_ERROR;
|
735
|
+
|
736
|
+
case 'g':
|
737
|
+
if (*p) {
|
738
|
+
ngx_conf_params = p;
|
739
|
+
goto next;
|
740
|
+
}
|
741
|
+
|
742
|
+
if (argv[++i]) {
|
743
|
+
ngx_conf_params = (u_char *) argv[i];
|
744
|
+
goto next;
|
745
|
+
}
|
746
|
+
|
747
|
+
ngx_log_stderr(0, "option \"-g\" requires parameter");
|
748
|
+
return NGX_ERROR;
|
749
|
+
|
750
|
+
case 's':
|
751
|
+
if (*p) {
|
752
|
+
ngx_signal = (char *) p;
|
753
|
+
|
754
|
+
} else if (argv[++i]) {
|
755
|
+
ngx_signal = argv[i];
|
756
|
+
|
757
|
+
} else {
|
758
|
+
ngx_log_stderr(0, "option \"-s\" requires parameter");
|
759
|
+
return NGX_ERROR;
|
760
|
+
}
|
761
|
+
|
762
|
+
if (ngx_strcmp(ngx_signal, "stop") == 0
|
763
|
+
|| ngx_strcmp(ngx_signal, "quit") == 0
|
764
|
+
|| ngx_strcmp(ngx_signal, "reopen") == 0
|
765
|
+
|| ngx_strcmp(ngx_signal, "reload") == 0)
|
766
|
+
{
|
767
|
+
ngx_process = NGX_PROCESS_SIGNALLER;
|
768
|
+
goto next;
|
769
|
+
}
|
770
|
+
|
771
|
+
ngx_log_stderr(0, "invalid option: \"-s %s\"", ngx_signal);
|
772
|
+
return NGX_ERROR;
|
773
|
+
|
774
|
+
default:
|
775
|
+
ngx_log_stderr(0, "invalid option: \"%c\"", *(p - 1));
|
776
|
+
return NGX_ERROR;
|
777
|
+
}
|
778
|
+
}
|
779
|
+
|
780
|
+
next:
|
781
|
+
|
782
|
+
continue;
|
783
|
+
}
|
784
|
+
|
785
|
+
return NGX_OK;
|
786
|
+
}
|
787
|
+
|
788
|
+
|
789
|
+
static ngx_int_t
|
790
|
+
ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv)
|
791
|
+
{
|
792
|
+
#if (NGX_FREEBSD)
|
793
|
+
|
794
|
+
ngx_os_argv = (char **) argv;
|
795
|
+
ngx_argc = argc;
|
796
|
+
ngx_argv = (char **) argv;
|
797
|
+
|
798
|
+
#else
|
799
|
+
size_t len;
|
800
|
+
ngx_int_t i;
|
801
|
+
|
802
|
+
ngx_os_argv = (char **) argv;
|
803
|
+
ngx_argc = argc;
|
804
|
+
|
805
|
+
ngx_argv = ngx_alloc((argc + 1) * sizeof(char *), cycle->log);
|
806
|
+
if (ngx_argv == NULL) {
|
807
|
+
return NGX_ERROR;
|
808
|
+
}
|
809
|
+
|
810
|
+
for (i = 0; i < argc; i++) {
|
811
|
+
len = ngx_strlen(argv[i]) + 1;
|
812
|
+
|
813
|
+
ngx_argv[i] = ngx_alloc(len, cycle->log);
|
814
|
+
if (ngx_argv[i] == NULL) {
|
815
|
+
return NGX_ERROR;
|
816
|
+
}
|
817
|
+
|
818
|
+
(void) ngx_cpystrn((u_char *) ngx_argv[i], (u_char *) argv[i], len);
|
819
|
+
}
|
820
|
+
|
821
|
+
ngx_argv[i] = NULL;
|
822
|
+
|
823
|
+
#endif
|
824
|
+
|
825
|
+
ngx_os_environ = environ;
|
826
|
+
|
827
|
+
return NGX_OK;
|
828
|
+
}
|
829
|
+
|
830
|
+
|
831
|
+
static ngx_int_t
|
832
|
+
ngx_process_options(ngx_cycle_t *cycle)
|
833
|
+
{
|
834
|
+
u_char *p;
|
835
|
+
size_t len;
|
836
|
+
|
837
|
+
if (ngx_prefix) {
|
838
|
+
len = ngx_strlen(ngx_prefix);
|
839
|
+
p = ngx_prefix;
|
840
|
+
|
841
|
+
if (!ngx_path_separator(*p)) {
|
842
|
+
p = ngx_pnalloc(cycle->pool, len + 1);
|
843
|
+
if (p == NULL) {
|
844
|
+
return NGX_ERROR;
|
845
|
+
}
|
846
|
+
|
847
|
+
ngx_memcpy(p, ngx_prefix, len);
|
848
|
+
p[len++] = '/';
|
849
|
+
}
|
850
|
+
|
851
|
+
cycle->conf_prefix.len = len;
|
852
|
+
cycle->conf_prefix.data = p;
|
853
|
+
cycle->prefix.len = len;
|
854
|
+
cycle->prefix.data = p;
|
855
|
+
|
856
|
+
} else {
|
857
|
+
|
858
|
+
#ifndef NGX_PREFIX
|
859
|
+
|
860
|
+
p = ngx_pnalloc(cycle->pool, NGX_MAX_PATH);
|
861
|
+
if (p == NULL) {
|
862
|
+
return NGX_ERROR;
|
863
|
+
}
|
864
|
+
|
865
|
+
if (ngx_getcwd(p, NGX_MAX_PATH) == 0) {
|
866
|
+
ngx_log_stderr(ngx_errno, "[emerg]: " ngx_getcwd_n " failed");
|
867
|
+
return NGX_ERROR;
|
868
|
+
}
|
869
|
+
|
870
|
+
len = ngx_strlen(p);
|
871
|
+
|
872
|
+
p[len++] = '/';
|
873
|
+
|
874
|
+
cycle->conf_prefix.len = len;
|
875
|
+
cycle->conf_prefix.data = p;
|
876
|
+
cycle->prefix.len = len;
|
877
|
+
cycle->prefix.data = p;
|
878
|
+
|
879
|
+
#else
|
880
|
+
|
881
|
+
#ifdef NGX_CONF_PREFIX
|
882
|
+
ngx_str_set(&cycle->conf_prefix, NGX_CONF_PREFIX);
|
883
|
+
#else
|
884
|
+
ngx_str_set(&cycle->conf_prefix, NGX_PREFIX);
|
885
|
+
#endif
|
886
|
+
ngx_str_set(&cycle->prefix, NGX_PREFIX);
|
887
|
+
|
888
|
+
#endif
|
889
|
+
}
|
890
|
+
|
891
|
+
if (ngx_conf_file) {
|
892
|
+
cycle->conf_file.len = ngx_strlen(ngx_conf_file);
|
893
|
+
cycle->conf_file.data = ngx_conf_file;
|
894
|
+
|
895
|
+
} else {
|
896
|
+
ngx_str_set(&cycle->conf_file, NGX_CONF_PATH);
|
897
|
+
}
|
898
|
+
|
899
|
+
if (ngx_conf_full_name(cycle, &cycle->conf_file, 0) != NGX_OK) {
|
900
|
+
return NGX_ERROR;
|
901
|
+
}
|
902
|
+
|
903
|
+
for (p = cycle->conf_file.data + cycle->conf_file.len - 1;
|
904
|
+
p > cycle->conf_file.data;
|
905
|
+
p--)
|
906
|
+
{
|
907
|
+
if (ngx_path_separator(*p)) {
|
908
|
+
cycle->conf_prefix.len = p - ngx_cycle->conf_file.data + 1;
|
909
|
+
cycle->conf_prefix.data = ngx_cycle->conf_file.data;
|
910
|
+
break;
|
911
|
+
}
|
912
|
+
}
|
913
|
+
|
914
|
+
if (ngx_conf_params) {
|
915
|
+
cycle->conf_param.len = ngx_strlen(ngx_conf_params);
|
916
|
+
cycle->conf_param.data = ngx_conf_params;
|
917
|
+
}
|
918
|
+
|
919
|
+
if (ngx_test_config) {
|
920
|
+
cycle->log->log_level = NGX_LOG_INFO;
|
921
|
+
}
|
922
|
+
|
923
|
+
return NGX_OK;
|
924
|
+
}
|
925
|
+
|
926
|
+
|
927
|
+
static void *
|
928
|
+
ngx_core_module_create_conf(ngx_cycle_t *cycle)
|
929
|
+
{
|
930
|
+
ngx_core_conf_t *ccf;
|
931
|
+
|
932
|
+
ccf = ngx_pcalloc(cycle->pool, sizeof(ngx_core_conf_t));
|
933
|
+
if (ccf == NULL) {
|
934
|
+
return NULL;
|
935
|
+
}
|
936
|
+
|
937
|
+
/*
|
938
|
+
* set by ngx_pcalloc()
|
939
|
+
*
|
940
|
+
* ccf->pid = NULL;
|
941
|
+
* ccf->oldpid = NULL;
|
942
|
+
* ccf->priority = 0;
|
943
|
+
* ccf->cpu_affinity_n = 0;
|
944
|
+
* ccf->cpu_affinity = NULL;
|
945
|
+
*/
|
946
|
+
|
947
|
+
ccf->daemon = NGX_CONF_UNSET;
|
948
|
+
ccf->master = NGX_CONF_UNSET;
|
949
|
+
ccf->timer_resolution = NGX_CONF_UNSET_MSEC;
|
950
|
+
|
951
|
+
ccf->worker_processes = NGX_CONF_UNSET;
|
952
|
+
ccf->debug_points = NGX_CONF_UNSET;
|
953
|
+
|
954
|
+
ccf->rlimit_nofile = NGX_CONF_UNSET;
|
955
|
+
ccf->rlimit_core = NGX_CONF_UNSET;
|
956
|
+
ccf->rlimit_sigpending = NGX_CONF_UNSET;
|
957
|
+
|
958
|
+
ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT;
|
959
|
+
ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT;
|
960
|
+
|
961
|
+
#if (NGX_THREADS)
|
962
|
+
ccf->worker_threads = NGX_CONF_UNSET;
|
963
|
+
ccf->thread_stack_size = NGX_CONF_UNSET_SIZE;
|
964
|
+
#endif
|
965
|
+
|
966
|
+
if (ngx_array_init(&ccf->env, cycle->pool, 1, sizeof(ngx_str_t))
|
967
|
+
!= NGX_OK)
|
968
|
+
{
|
969
|
+
return NULL;
|
970
|
+
}
|
971
|
+
|
972
|
+
return ccf;
|
973
|
+
}
|
974
|
+
|
975
|
+
|
976
|
+
static char *
|
977
|
+
ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
|
978
|
+
{
|
979
|
+
ngx_core_conf_t *ccf = conf;
|
980
|
+
|
981
|
+
ngx_conf_init_value(ccf->daemon, 1);
|
982
|
+
ngx_conf_init_value(ccf->master, 1);
|
983
|
+
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
|
984
|
+
|
985
|
+
ngx_conf_init_value(ccf->worker_processes, 1);
|
986
|
+
ngx_conf_init_value(ccf->debug_points, 0);
|
987
|
+
|
988
|
+
#if (NGX_HAVE_SCHED_SETAFFINITY)
|
989
|
+
|
990
|
+
if (ccf->cpu_affinity_n
|
991
|
+
&& ccf->cpu_affinity_n != 1
|
992
|
+
&& ccf->cpu_affinity_n != (ngx_uint_t) ccf->worker_processes)
|
993
|
+
{
|
994
|
+
ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
|
995
|
+
"number of the \"worker_processes\" is not equal to "
|
996
|
+
"the number of the \"worker_cpu_affinity\" mask, "
|
997
|
+
"using last mask for remaining worker processes");
|
998
|
+
}
|
999
|
+
|
1000
|
+
#endif
|
1001
|
+
|
1002
|
+
#if (NGX_THREADS)
|
1003
|
+
|
1004
|
+
ngx_conf_init_value(ccf->worker_threads, 0);
|
1005
|
+
ngx_threads_n = ccf->worker_threads;
|
1006
|
+
ngx_conf_init_size_value(ccf->thread_stack_size, 2 * 1024 * 1024);
|
1007
|
+
|
1008
|
+
#endif
|
1009
|
+
|
1010
|
+
|
1011
|
+
if (ccf->pid.len == 0) {
|
1012
|
+
ngx_str_set(&ccf->pid, NGX_PID_PATH);
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
if (ngx_conf_full_name(cycle, &ccf->pid, 0) != NGX_OK) {
|
1016
|
+
return NGX_CONF_ERROR;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
ccf->oldpid.len = ccf->pid.len + sizeof(NGX_OLDPID_EXT);
|
1020
|
+
|
1021
|
+
ccf->oldpid.data = ngx_pnalloc(cycle->pool, ccf->oldpid.len);
|
1022
|
+
if (ccf->oldpid.data == NULL) {
|
1023
|
+
return NGX_CONF_ERROR;
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
ngx_memcpy(ngx_cpymem(ccf->oldpid.data, ccf->pid.data, ccf->pid.len),
|
1027
|
+
NGX_OLDPID_EXT, sizeof(NGX_OLDPID_EXT));
|
1028
|
+
|
1029
|
+
|
1030
|
+
#if !(NGX_WIN32)
|
1031
|
+
|
1032
|
+
if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
|
1033
|
+
struct group *grp;
|
1034
|
+
struct passwd *pwd;
|
1035
|
+
|
1036
|
+
ngx_set_errno(0);
|
1037
|
+
pwd = getpwnam(NGX_USER);
|
1038
|
+
if (pwd == NULL) {
|
1039
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
1040
|
+
"getpwnam(\"" NGX_USER "\") failed");
|
1041
|
+
return NGX_CONF_ERROR;
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
ccf->username = NGX_USER;
|
1045
|
+
ccf->user = pwd->pw_uid;
|
1046
|
+
|
1047
|
+
ngx_set_errno(0);
|
1048
|
+
grp = getgrnam(NGX_GROUP);
|
1049
|
+
if (grp == NULL) {
|
1050
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
1051
|
+
"getgrnam(\"" NGX_GROUP "\") failed");
|
1052
|
+
return NGX_CONF_ERROR;
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
ccf->group = grp->gr_gid;
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
|
1059
|
+
if (ccf->lock_file.len == 0) {
|
1060
|
+
ngx_str_set(&ccf->lock_file, NGX_LOCK_PATH);
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) != NGX_OK) {
|
1064
|
+
return NGX_CONF_ERROR;
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
{
|
1068
|
+
ngx_str_t lock_file;
|
1069
|
+
|
1070
|
+
lock_file = cycle->old_cycle->lock_file;
|
1071
|
+
|
1072
|
+
if (lock_file.len) {
|
1073
|
+
lock_file.len--;
|
1074
|
+
|
1075
|
+
if (ccf->lock_file.len != lock_file.len
|
1076
|
+
|| ngx_strncmp(ccf->lock_file.data, lock_file.data, lock_file.len)
|
1077
|
+
!= 0)
|
1078
|
+
{
|
1079
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
|
1080
|
+
"\"lock_file\" could not be changed, ignored");
|
1081
|
+
}
|
1082
|
+
|
1083
|
+
cycle->lock_file.len = lock_file.len + 1;
|
1084
|
+
lock_file.len += sizeof(".accept");
|
1085
|
+
|
1086
|
+
cycle->lock_file.data = ngx_pstrdup(cycle->pool, &lock_file);
|
1087
|
+
if (cycle->lock_file.data == NULL) {
|
1088
|
+
return NGX_CONF_ERROR;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
} else {
|
1092
|
+
cycle->lock_file.len = ccf->lock_file.len + 1;
|
1093
|
+
cycle->lock_file.data = ngx_pnalloc(cycle->pool,
|
1094
|
+
ccf->lock_file.len + sizeof(".accept"));
|
1095
|
+
if (cycle->lock_file.data == NULL) {
|
1096
|
+
return NGX_CONF_ERROR;
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
ngx_memcpy(ngx_cpymem(cycle->lock_file.data, ccf->lock_file.data,
|
1100
|
+
ccf->lock_file.len),
|
1101
|
+
".accept", sizeof(".accept"));
|
1102
|
+
}
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
#endif
|
1106
|
+
|
1107
|
+
return NGX_CONF_OK;
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
|
1111
|
+
static char *
|
1112
|
+
ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1113
|
+
{
|
1114
|
+
#if (NGX_WIN32)
|
1115
|
+
|
1116
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1117
|
+
"\"user\" is not supported, ignored");
|
1118
|
+
|
1119
|
+
return NGX_CONF_OK;
|
1120
|
+
|
1121
|
+
#else
|
1122
|
+
|
1123
|
+
ngx_core_conf_t *ccf = conf;
|
1124
|
+
|
1125
|
+
char *group;
|
1126
|
+
struct passwd *pwd;
|
1127
|
+
struct group *grp;
|
1128
|
+
ngx_str_t *value;
|
1129
|
+
|
1130
|
+
if (ccf->user != (uid_t) NGX_CONF_UNSET_UINT) {
|
1131
|
+
return "is duplicate";
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
if (geteuid() != 0) {
|
1135
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1136
|
+
"the \"user\" directive makes sense only "
|
1137
|
+
"if the master process runs "
|
1138
|
+
"with super-user privileges, ignored");
|
1139
|
+
return NGX_CONF_OK;
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
value = (ngx_str_t *) cf->args->elts;
|
1143
|
+
|
1144
|
+
ccf->username = (char *) value[1].data;
|
1145
|
+
|
1146
|
+
ngx_set_errno(0);
|
1147
|
+
pwd = getpwnam((const char *) value[1].data);
|
1148
|
+
if (pwd == NULL) {
|
1149
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
1150
|
+
"getpwnam(\"%s\") failed", value[1].data);
|
1151
|
+
return NGX_CONF_ERROR;
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
ccf->user = pwd->pw_uid;
|
1155
|
+
|
1156
|
+
group = (char *) ((cf->args->nelts == 2) ? value[1].data : value[2].data);
|
1157
|
+
|
1158
|
+
ngx_set_errno(0);
|
1159
|
+
grp = getgrnam(group);
|
1160
|
+
if (grp == NULL) {
|
1161
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
1162
|
+
"getgrnam(\"%s\") failed", group);
|
1163
|
+
return NGX_CONF_ERROR;
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
ccf->group = grp->gr_gid;
|
1167
|
+
|
1168
|
+
return NGX_CONF_OK;
|
1169
|
+
|
1170
|
+
#endif
|
1171
|
+
}
|
1172
|
+
|
1173
|
+
|
1174
|
+
static char *
|
1175
|
+
ngx_set_env(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1176
|
+
{
|
1177
|
+
ngx_core_conf_t *ccf = conf;
|
1178
|
+
|
1179
|
+
ngx_str_t *value, *var;
|
1180
|
+
ngx_uint_t i;
|
1181
|
+
|
1182
|
+
var = ngx_array_push(&ccf->env);
|
1183
|
+
if (var == NULL) {
|
1184
|
+
return NGX_CONF_ERROR;
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
value = cf->args->elts;
|
1188
|
+
*var = value[1];
|
1189
|
+
|
1190
|
+
for (i = 0; i < value[1].len; i++) {
|
1191
|
+
|
1192
|
+
if (value[1].data[i] == '=') {
|
1193
|
+
|
1194
|
+
var->len = i;
|
1195
|
+
|
1196
|
+
return NGX_CONF_OK;
|
1197
|
+
}
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
return NGX_CONF_OK;
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
|
1204
|
+
static char *
|
1205
|
+
ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1206
|
+
{
|
1207
|
+
ngx_core_conf_t *ccf = conf;
|
1208
|
+
|
1209
|
+
ngx_str_t *value;
|
1210
|
+
ngx_uint_t n, minus;
|
1211
|
+
|
1212
|
+
if (ccf->priority != 0) {
|
1213
|
+
return "is duplicate";
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
value = cf->args->elts;
|
1217
|
+
|
1218
|
+
if (value[1].data[0] == '-') {
|
1219
|
+
n = 1;
|
1220
|
+
minus = 1;
|
1221
|
+
|
1222
|
+
} else if (value[1].data[0] == '+') {
|
1223
|
+
n = 1;
|
1224
|
+
minus = 0;
|
1225
|
+
|
1226
|
+
} else {
|
1227
|
+
n = 0;
|
1228
|
+
minus = 0;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
ccf->priority = ngx_atoi(&value[1].data[n], value[1].len - n);
|
1232
|
+
if (ccf->priority == NGX_ERROR) {
|
1233
|
+
return "invalid number";
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
if (minus) {
|
1237
|
+
ccf->priority = -ccf->priority;
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
return NGX_CONF_OK;
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
|
1244
|
+
static char *
|
1245
|
+
ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1246
|
+
{
|
1247
|
+
#if (NGX_HAVE_SCHED_SETAFFINITY)
|
1248
|
+
ngx_core_conf_t *ccf = conf;
|
1249
|
+
|
1250
|
+
u_char ch;
|
1251
|
+
u_long *mask;
|
1252
|
+
ngx_str_t *value;
|
1253
|
+
ngx_uint_t i, n;
|
1254
|
+
|
1255
|
+
if (ccf->cpu_affinity) {
|
1256
|
+
return "is duplicate";
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
mask = ngx_palloc(cf->pool, (cf->args->nelts - 1) * sizeof(long));
|
1260
|
+
if (mask == NULL) {
|
1261
|
+
return NGX_CONF_ERROR;
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
ccf->cpu_affinity_n = cf->args->nelts - 1;
|
1265
|
+
ccf->cpu_affinity = mask;
|
1266
|
+
|
1267
|
+
value = cf->args->elts;
|
1268
|
+
|
1269
|
+
for (n = 1; n < cf->args->nelts; n++) {
|
1270
|
+
|
1271
|
+
if (value[n].len > 32) {
|
1272
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
1273
|
+
"\"worker_cpu_affinity\" supports up to 32 CPU only");
|
1274
|
+
return NGX_CONF_ERROR;
|
1275
|
+
}
|
1276
|
+
|
1277
|
+
mask[n - 1] = 0;
|
1278
|
+
|
1279
|
+
for (i = 0; i < value[n].len; i++) {
|
1280
|
+
|
1281
|
+
ch = value[n].data[i];
|
1282
|
+
|
1283
|
+
if (ch == ' ') {
|
1284
|
+
continue;
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
mask[n - 1] <<= 1;
|
1288
|
+
|
1289
|
+
if (ch == '0') {
|
1290
|
+
continue;
|
1291
|
+
}
|
1292
|
+
|
1293
|
+
if (ch == '1') {
|
1294
|
+
mask[n - 1] |= 1;
|
1295
|
+
continue;
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
1299
|
+
"invalid character \"%c\" in \"worker_cpu_affinity\"",
|
1300
|
+
ch);
|
1301
|
+
return NGX_CONF_ERROR;
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
#else
|
1306
|
+
|
1307
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1308
|
+
"\"worker_cpu_affinity\" is not supported "
|
1309
|
+
"on this platform, ignored");
|
1310
|
+
#endif
|
1311
|
+
|
1312
|
+
return NGX_CONF_OK;
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
|
1316
|
+
u_long
|
1317
|
+
ngx_get_cpu_affinity(ngx_uint_t n)
|
1318
|
+
{
|
1319
|
+
ngx_core_conf_t *ccf;
|
1320
|
+
|
1321
|
+
ccf = (ngx_core_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
|
1322
|
+
ngx_core_module);
|
1323
|
+
|
1324
|
+
if (ccf->cpu_affinity == NULL) {
|
1325
|
+
return 0;
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
if (ccf->cpu_affinity_n > n) {
|
1329
|
+
return ccf->cpu_affinity[n];
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
return ccf->cpu_affinity[ccf->cpu_affinity_n - 1];
|
1333
|
+
}
|