最近、nginxに興味がでてきた(コンフィグ設定で苦しんだ)ので、ソースを取得してみた。
C言語で作られていたんだ。全く知らなかった。
PS c:\nginx-1.19.6> tree /F . フォルダー パスの一覧 ボリューム シリアル番号は B247-D316 です c:\NGINX-1.19.6 │ CHANGES │ CHANGES.ru │ configure │ LICENSE │ README │ ├─auto │ │ define │ │ endianness │ │ feature │ │ have │ │ have_headers │ │ headers │ │ include │ │ init │ │ install │ │ make │ │ module │ │ modules │ │ nohave │ │ options │ │ sources │ │ stubs │ │ summary │ │ threads │ │ unix │ │ │ ├─cc │ │ acc │ │ bcc │ │ ccc │ │ clang │ │ conf │ │ gcc │ │ icc │ │ msvc │ │ name │ │ owc │ │ sunc │ │ │ ├─lib │ │ │ conf │ │ │ make │ │ │ │ │ ├─geoip │ │ │ conf │ │ │ │ │ ├─google-perftools │ │ │ conf │ │ │ │ │ ├─libatomic │ │ │ conf │ │ │ make │ │ │ │ │ ├─libgd │ │ │ conf │ │ │ │ │ ├─libxslt │ │ │ conf │ │ │ │ │ ├─openssl │ │ │ conf │ │ │ make │ │ │ makefile.bcc │ │ │ makefile.msvc │ │ │ │ │ ├─pcre │ │ │ conf │ │ │ make │ │ │ makefile.bcc │ │ │ makefile.msvc │ │ │ makefile.owc │ │ │ │ │ ├─perl │ │ │ conf │ │ │ make │ │ │ │ │ └─zlib │ │ conf │ │ make │ │ makefile.bcc │ │ makefile.msvc │ │ makefile.owc │ │ │ ├─os │ │ conf │ │ darwin │ │ freebsd │ │ linux │ │ solaris │ │ win32 │ │ │ └─types │ sizeof │ typedef │ uintptr_t │ value │ ├─conf │ fastcgi.conf │ fastcgi_params │ koi-utf │ koi-win │ mime.types │ nginx.conf │ scgi_params │ uwsgi_params │ win-utf │ ├─contrib │ │ geo2nginx.pl │ │ README │ │ │ ├─unicode2nginx │ │ koi-utf │ │ unicode-to-nginx.pl │ │ win-utf │ │ │ └─vim │ ├─ftdetect │ │ nginx.vim │ │ │ ├─ftplugin │ │ nginx.vim │ │ │ ├─indent │ │ nginx.vim │ │ │ └─syntax │ nginx.vim │ ├─html │ 50x.html │ index.html │ ├─man │ nginx.8 │ └─src ├─core │ nginx.c │ nginx.h │ ngx_array.c │ ngx_array.h │ ngx_buf.c │ ngx_buf.h │ ngx_config.h │ ngx_conf_file.c │ ngx_conf_file.h │ ngx_connection.c │ ngx_connection.h │ ngx_core.h │ ngx_cpuinfo.c │ ngx_crc.h │ ngx_crc32.c │ ngx_crc32.h │ ngx_crypt.c │ ngx_crypt.h │ ngx_cycle.c │ ngx_cycle.h │ ngx_file.c │ ngx_file.h │ ngx_hash.c │ ngx_hash.h │ ngx_inet.c │ ngx_inet.h │ ngx_list.c │ ngx_list.h │ ngx_log.c │ ngx_log.h │ ngx_md5.c │ ngx_md5.h │ ngx_module.c │ ngx_module.h │ ngx_murmurhash.c │ ngx_murmurhash.h │ ngx_open_file_cache.c │ ngx_open_file_cache.h │ ngx_output_chain.c │ ngx_palloc.c │ ngx_palloc.h │ ngx_parse.c │ ngx_parse.h │ ngx_parse_time.c │ ngx_parse_time.h │ ngx_proxy_protocol.c │ ngx_proxy_protocol.h │ ngx_queue.c │ ngx_queue.h │ ngx_radix_tree.c │ ngx_radix_tree.h │ ngx_rbtree.c │ ngx_rbtree.h │ ngx_regex.c │ ngx_regex.h │ ngx_resolver.c │ ngx_resolver.h │ ngx_rwlock.c │ ngx_rwlock.h │ ngx_sha1.c │ ngx_sha1.h │ ngx_shmtx.c │ ngx_shmtx.h │ ngx_slab.c │ ngx_slab.h │ ngx_spinlock.c │ ngx_string.c │ ngx_string.h │ ngx_syslog.c │ ngx_syslog.h │ ngx_thread_pool.c │ ngx_thread_pool.h │ ngx_times.c │ ngx_times.h │ ├─event │ │ ngx_event.c │ │ ngx_event.h │ │ ngx_event_accept.c │ │ ngx_event_connect.c │ │ ngx_event_connect.h │ │ ngx_event_openssl.c │ │ ngx_event_openssl.h │ │ ngx_event_openssl_stapling.c │ │ ngx_event_pipe.c │ │ ngx_event_pipe.h │ │ ngx_event_posted.c │ │ ngx_event_posted.h │ │ ngx_event_timer.c │ │ ngx_event_timer.h │ │ ngx_event_udp.c │ │ │ └─modules │ ngx_devpoll_module.c │ ngx_epoll_module.c │ ngx_eventport_module.c │ ngx_kqueue_module.c │ ngx_poll_module.c │ ngx_select_module.c │ ngx_win32_poll_module.c │ ngx_win32_select_module.c │ ├─http │ │ ngx_http.c │ │ ngx_http.h │ │ ngx_http_cache.h │ │ ngx_http_config.h │ │ ngx_http_copy_filter_module.c │ │ ngx_http_core_module.c │ │ ngx_http_core_module.h │ │ ngx_http_file_cache.c │ │ ngx_http_header_filter_module.c │ │ ngx_http_parse.c │ │ ngx_http_postpone_filter_module.c │ │ ngx_http_request.c │ │ ngx_http_request.h │ │ ngx_http_request_body.c │ │ ngx_http_script.c │ │ ngx_http_script.h │ │ ngx_http_special_response.c │ │ ngx_http_upstream.c │ │ ngx_http_upstream.h │ │ ngx_http_upstream_round_robin.c │ │ ngx_http_upstream_round_robin.h │ │ ngx_http_variables.c │ │ ngx_http_variables.h │ │ ngx_http_write_filter_module.c │ │ │ ├─modules │ │ │ ngx_http_access_module.c │ │ │ ngx_http_addition_filter_module.c │ │ │ ngx_http_auth_basic_module.c │ │ │ ngx_http_auth_request_module.c │ │ │ ngx_http_autoindex_module.c │ │ │ ngx_http_browser_module.c │ │ │ ngx_http_charset_filter_module.c │ │ │ ngx_http_chunked_filter_module.c │ │ │ ngx_http_dav_module.c │ │ │ ngx_http_degradation_module.c │ │ │ ngx_http_empty_gif_module.c │ │ │ ngx_http_fastcgi_module.c │ │ │ ngx_http_flv_module.c │ │ │ ngx_http_geoip_module.c │ │ │ ngx_http_geo_module.c │ │ │ ngx_http_grpc_module.c │ │ │ ngx_http_gunzip_filter_module.c │ │ │ ngx_http_gzip_filter_module.c │ │ │ ngx_http_gzip_static_module.c │ │ │ ngx_http_headers_filter_module.c │ │ │ ngx_http_image_filter_module.c │ │ │ ngx_http_index_module.c │ │ │ ngx_http_limit_conn_module.c │ │ │ ngx_http_limit_req_module.c │ │ │ ngx_http_log_module.c │ │ │ ngx_http_map_module.c │ │ │ ngx_http_memcached_module.c │ │ │ ngx_http_mirror_module.c │ │ │ ngx_http_mp4_module.c │ │ │ ngx_http_not_modified_filter_module.c │ │ │ ngx_http_proxy_module.c │ │ │ ngx_http_random_index_module.c │ │ │ ngx_http_range_filter_module.c │ │ │ ngx_http_realip_module.c │ │ │ ngx_http_referer_module.c │ │ │ ngx_http_rewrite_module.c │ │ │ ngx_http_scgi_module.c │ │ │ ngx_http_secure_link_module.c │ │ │ ngx_http_slice_filter_module.c │ │ │ ngx_http_split_clients_module.c │ │ │ ngx_http_ssi_filter_module.c │ │ │ ngx_http_ssi_filter_module.h │ │ │ ngx_http_ssl_module.c │ │ │ ngx_http_ssl_module.h │ │ │ ngx_http_static_module.c │ │ │ ngx_http_stub_status_module.c │ │ │ ngx_http_sub_filter_module.c │ │ │ ngx_http_try_files_module.c │ │ │ ngx_http_upstream_hash_module.c │ │ │ ngx_http_upstream_ip_hash_module.c │ │ │ ngx_http_upstream_keepalive_module.c │ │ │ ngx_http_upstream_least_conn_module.c │ │ │ ngx_http_upstream_random_module.c │ │ │ ngx_http_upstream_zone_module.c │ │ │ ngx_http_userid_filter_module.c │ │ │ ngx_http_uwsgi_module.c │ │ │ ngx_http_xslt_filter_module.c │ │ │ │ │ └─perl │ │ Makefile.PL │ │ nginx.pm │ │ nginx.xs │ │ ngx_http_perl_module.c │ │ ngx_http_perl_module.h │ │ typemap │ │ │ └─v2 │ ngx_http_v2.c │ ngx_http_v2.h │ ngx_http_v2_encode.c │ ngx_http_v2_filter_module.c │ ngx_http_v2_huff_decode.c │ ngx_http_v2_huff_encode.c │ ngx_http_v2_module.c │ ngx_http_v2_module.h │ ngx_http_v2_table.c │ ├─mail │ ngx_mail.c │ ngx_mail.h │ ngx_mail_auth_http_module.c │ ngx_mail_core_module.c │ ngx_mail_handler.c │ ngx_mail_imap_handler.c │ ngx_mail_imap_module.c │ ngx_mail_imap_module.h │ ngx_mail_parse.c │ ngx_mail_pop3_handler.c │ ngx_mail_pop3_module.c │ ngx_mail_pop3_module.h │ ngx_mail_proxy_module.c │ ngx_mail_smtp_handler.c │ ngx_mail_smtp_module.c │ ngx_mail_smtp_module.h │ ngx_mail_ssl_module.c │ ngx_mail_ssl_module.h │ ├─misc │ ngx_cpp_test_module.cpp │ ngx_google_perftools_module.c │ ├─os │ └─unix │ ngx_alloc.c │ ngx_alloc.h │ ngx_atomic.h │ ngx_channel.c │ ngx_channel.h │ ngx_daemon.c │ ngx_darwin.h │ ngx_darwin_config.h │ ngx_darwin_init.c │ ngx_darwin_sendfile_chain.c │ ngx_dlopen.c │ ngx_dlopen.h │ ngx_errno.c │ ngx_errno.h │ ngx_files.c │ ngx_files.h │ ngx_file_aio_read.c │ ngx_freebsd.h │ ngx_freebsd_config.h │ ngx_freebsd_init.c │ ngx_freebsd_sendfile_chain.c │ ngx_gcc_atomic_amd64.h │ ngx_gcc_atomic_ppc.h │ ngx_gcc_atomic_sparc64.h │ ngx_gcc_atomic_x86.h │ ngx_linux.h │ ngx_linux_aio_read.c │ ngx_linux_config.h │ ngx_linux_init.c │ ngx_linux_sendfile_chain.c │ ngx_os.h │ ngx_posix_config.h │ ngx_posix_init.c │ ngx_process.c │ ngx_process.h │ ngx_process_cycle.c │ ngx_process_cycle.h │ ngx_readv_chain.c │ ngx_recv.c │ ngx_send.c │ ngx_setaffinity.c │ ngx_setaffinity.h │ ngx_setproctitle.c │ ngx_setproctitle.h │ ngx_shmem.c │ ngx_shmem.h │ ngx_socket.c │ ngx_socket.h │ ngx_solaris.h │ ngx_solaris_config.h │ ngx_solaris_init.c │ ngx_solaris_sendfilev_chain.c │ ngx_sunpro_amd64.il │ ngx_sunpro_atomic_sparc64.h │ ngx_sunpro_sparc64.il │ ngx_sunpro_x86.il │ ngx_thread.h │ ngx_thread_cond.c │ ngx_thread_id.c │ ngx_thread_mutex.c │ ngx_time.c │ ngx_time.h │ ngx_udp_recv.c │ ngx_udp_send.c │ ngx_udp_sendmsg_chain.c │ ngx_user.c │ ngx_user.h │ ngx_writev_chain.c │ └─stream ngx_stream.c ngx_stream.h ngx_stream_access_module.c ngx_stream_core_module.c ngx_stream_geoip_module.c ngx_stream_geo_module.c ngx_stream_handler.c ngx_stream_limit_conn_module.c ngx_stream_log_module.c ngx_stream_map_module.c ngx_stream_proxy_module.c ngx_stream_realip_module.c ngx_stream_return_module.c ngx_stream_script.c ngx_stream_script.h ngx_stream_set_module.c ngx_stream_split_clients_module.c ngx_stream_ssl_module.c ngx_stream_ssl_module.h ngx_stream_ssl_preread_module.c ngx_stream_upstream.c ngx_stream_upstream.h ngx_stream_upstream_hash_module.c ngx_stream_upstream_least_conn_module.c ngx_stream_upstream_random_module.c ngx_stream_upstream_round_robin.c ngx_stream_upstream_round_robin.h ngx_stream_upstream_zone_module.c ngx_stream_variables.c ngx_stream_variables.h ngx_stream_write_filter_module.c
C言語といえば、Main()関数を探したくなるので、ちょっと調査 今度読んでみよう!
PS c:\nginx-1.19.6> Get-ChildItem . -include * -Recurse -Force | Select-String "main\(" -Encoding default auto\cc\sunc:26:int main(void) { auto\types\sizeof:28:int main(void) { auto\types\typedef:30:int main(void) { auto\types\uintptr_t:22:int main(void) { auto\endianness:18:int main(void) { auto\feature:34:int main(void) auto\include:23:int main(void) { src\core\nginx.c:196:main(int argc, char *const *argv) src\event\ngx_event_openssl.c:5166:ngx_ssl_get_client_v_remain(ngx_connection_t *c, ngx_pool_t *pool, ngx_str_t *s) src\event\ngx_event_openssl.h:282:ngx_int_t ngx_ssl_get_client_v_remain(ngx_connection_t *c, ngx_pool_t *pool, src\http\modules\ngx_http_proxy_module.c:213:static char *ngx_http_proxy_cookie_domain(ngx_conf_t *cf, ngx_command_t *cmd, src\http\modules\ngx_http_proxy_module.c:4321:ngx_http_proxy_cookie_domain(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) src\http\modules\ngx_http_userid_filter_module.c:69:static char *ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data); src\http\modules\ngx_http_userid_filter_module.c:790:ngx_http_userid_domain(ngx_conf_t *cf, void *post, void *data) PS c:\nginx-1.19.6>
コメント