程序结构

  1. [root@localhost conf.d]# rpm -ql nginx
  2. /etc/logrotate.d/nginx # 日志切割
  3. /etc/nginx # Nginx主程序的存放位置
  4. /etc/nginx/conf.d # Nginx的子配置文件目录
  5. /etc/nginx/conf.d/default.conf # Nginx默认的配置文件
  6. /etc/nginx/fastcgi_params # Nginx与php交互的内置变量
  7. /etc/nginx/mime.types # 存放响应报文中回传的文件类型
  8. /etc/nginx/modules # 存放Nginx程序模块路径
  9. /etc/nginx/nginx.conf # Nginx主配置文件
  10. /etc/nginx/scgi_params
  11. /etc/nginx/uwsgi_params # 存放uwsgi交互的内置变量
  12. /usr/lib/systemd/system/nginx-debug.service
  13. /usr/lib/systemd/system/nginx.service
  14. /usr/lib64/nginx
  15. /usr/lib64/nginx/modules
  16. /usr/libexec/initscripts/legacy-actions/nginx
  17. /usr/libexec/initscripts/legacy-actions/nginx/check-reload
  18. /usr/libexec/initscripts/legacy-actions/nginx/upgrade
  19. /usr/sbin/nginx # 二进制文件 调用控制Nginx的文件
  20. /usr/sbin/nginx-debug
  21. /usr/share/doc/nginx-1.21.1
  22. /usr/share/doc/nginx-1.21.1/COPYRIGHT
  23. /usr/share/man/man8/nginx.8.gz
  24. /usr/share/nginx # Nginx默认存放源码的位置
  25. /usr/share/nginx/html
  26. /usr/share/nginx/html/50x.html
  27. /usr/share/nginx/html/index.html
  28. /var/cache/nginx
  29. /var/log/nginx # 存放Nginx日志的路径
  30. [root@localhost conf.d]#

因为安装的缘故 与老师的有点冲突 还有一个路径如下图的配置
image.png
内容如下 告诉系统当前执行的 nginx 的主配置文件在哪儿 执行的nginx 二进制文件是哪个
image.png

压缩包结构

  1. [root@localhost nginx-1.21.1]# ll
  2. 总用量 792
  3. drwxr-xr-x 6 1001 1001 326 8 1 16:49 auto 存放编译相关的脚本文件
  4. -rw-r--r-- 1 1001 1001 313379 7 6 22:59 CHANGES 变更日志
  5. -rw-r--r-- 1 1001 1001 478586 7 6 22:59 CHANGES.ru 变更日志 俄文版本
  6. drwxr-xr-x 2 1001 1001 168 8 1 16:49 conf 配置文件列表
  7. -rwxr-xr-x 1 1001 1001 2590 7 6 22:59 configure nginx的脚本文件 生成makefile,检测环境等
  8. drwxr-xr-x 4 1001 1001 72 8 1 16:49 contrib 存放部分脚本
  9. drwxr-xr-x 2 1001 1001 40 8 1 16:49 html 默认页面存放文件夹
  10. -rw-r--r-- 1 1001 1001 1397 7 6 22:59 LICENSE 许可证描述文件
  11. -rw-r--r-- 1 root root 69 8 1 16:52 Makefile configure 编译生成的内容
  12. drwxr-xr-x 2 1001 1001 21 8 1 16:49 man 帮助文档
  13. drwxr-xr-x 2 root root 77 8 1 16:52 objs configure 编译生成的内容
  14. -rw-r--r-- 1 1001 1001 49 7 6 22:59 README 读我读我读我
  15. drwxr-xr-x 9 1001 1001 91 8 1 16:49 src nginx的源码

configure帮助

  1. [root@localhost nginx-1.21.1]# ./configure --help
  2. --help print this message
  3. --prefix=PATH set installation prefix
  4. --sbin-path=PATH set nginx binary pathname
  5. --modules-path=PATH set modules path
  6. --conf-path=PATH set nginx.conf pathname
  7. --error-log-path=PATH set error log pathname
  8. --pid-path=PATH set nginx.pid pathname
  9. --lock-path=PATH set nginx.lock pathname
  10. --user=USER set non-privileged user for
  11. worker processes
  12. --group=GROUP set non-privileged group for
  13. worker processes
  14. --build=NAME set build name
  15. --builddir=DIR set build directory
  16. --with-select_module enable select module
  17. --without-select_module disable select module
  18. --with-poll_module enable poll module
  19. --without-poll_module disable poll module
  20. --with-threads enable thread pool support
  21. --with-file-aio enable file AIO support
  22. --with-http_ssl_module enable ngx_http_ssl_module
  23. --with-http_v2_module enable ngx_http_v2_module
  24. --with-http_realip_module enable ngx_http_realip_module
  25. --with-http_addition_module enable ngx_http_addition_module
  26. --with-http_xslt_module enable ngx_http_xslt_module
  27. --with-http_xslt_module=dynamic enable dynamic ngx_http_xslt_module
  28. --with-http_image_filter_module enable ngx_http_image_filter_module
  29. --with-http_image_filter_module=dynamic
  30. enable dynamic ngx_http_image_filter_module
  31. --with-http_geoip_module enable ngx_http_geoip_module
  32. --with-http_geoip_module=dynamic enable dynamic ngx_http_geoip_module
  33. --with-http_sub_module enable ngx_http_sub_module
  34. --with-http_dav_module enable ngx_http_dav_module
  35. --with-http_flv_module enable ngx_http_flv_module
  36. --with-http_mp4_module enable ngx_http_mp4_module
  37. --with-http_gunzip_module enable ngx_http_gunzip_module
  38. --with-http_gzip_static_module enable ngx_http_gzip_static_module
  39. --with-http_auth_request_module enable ngx_http_auth_request_module
  40. --with-http_random_index_module enable ngx_http_random_index_module
  41. --with-http_secure_link_module enable ngx_http_secure_link_module
  42. --with-http_degradation_module enable ngx_http_degradation_module
  43. --with-http_slice_module enable ngx_http_slice_module
  44. --with-http_stub_status_module enable ngx_http_stub_status_module
  45. --without-http_charset_module disable ngx_http_charset_module
  46. --without-http_gzip_module disable ngx_http_gzip_module
  47. --without-http_ssi_module disable ngx_http_ssi_module
  48. --without-http_userid_module disable ngx_http_userid_module
  49. --without-http_access_module disable ngx_http_access_module
  50. --without-http_auth_basic_module disable ngx_http_auth_basic_module
  51. --without-http_mirror_module disable ngx_http_mirror_module
  52. --without-http_autoindex_module disable ngx_http_autoindex_module
  53. --without-http_geo_module disable ngx_http_geo_module
  54. --without-http_map_module disable ngx_http_map_module
  55. --without-http_split_clients_module disable ngx_http_split_clients_module
  56. --without-http_referer_module disable ngx_http_referer_module
  57. --without-http_rewrite_module disable ngx_http_rewrite_module
  58. --without-http_proxy_module disable ngx_http_proxy_module
  59. --without-http_fastcgi_module disable ngx_http_fastcgi_module
  60. --without-http_uwsgi_module disable ngx_http_uwsgi_module
  61. --without-http_scgi_module disable ngx_http_scgi_module
  62. --without-http_grpc_module disable ngx_http_grpc_module
  63. --without-http_memcached_module disable ngx_http_memcached_module
  64. --without-http_limit_conn_module disable ngx_http_limit_conn_module
  65. --without-http_limit_req_module disable ngx_http_limit_req_module
  66. --without-http_empty_gif_module disable ngx_http_empty_gif_module
  67. --without-http_browser_module disable ngx_http_browser_module
  68. --without-http_upstream_hash_module
  69. disable ngx_http_upstream_hash_module
  70. --without-http_upstream_ip_hash_module
  71. disable ngx_http_upstream_ip_hash_module
  72. --without-http_upstream_least_conn_module
  73. disable ngx_http_upstream_least_conn_module
  74. --without-http_upstream_random_module
  75. disable ngx_http_upstream_random_module
  76. --without-http_upstream_keepalive_module
  77. disable ngx_http_upstream_keepalive_module
  78. --without-http_upstream_zone_module
  79. disable ngx_http_upstream_zone_module
  80. --with-http_perl_module enable ngx_http_perl_module
  81. --with-http_perl_module=dynamic enable dynamic ngx_http_perl_module
  82. --with-perl_modules_path=PATH set Perl modules path
  83. --with-perl=PATH set perl binary pathname
  84. --http-log-path=PATH set http access log pathname
  85. --http-client-body-temp-path=PATH set path to store
  86. http client request body temporary files
  87. --http-proxy-temp-path=PATH set path to store
  88. http proxy temporary files
  89. --http-fastcgi-temp-path=PATH set path to store
  90. http fastcgi temporary files
  91. --http-uwsgi-temp-path=PATH set path to store
  92. http uwsgi temporary files
  93. --http-scgi-temp-path=PATH set path to store
  94. http scgi temporary files
  95. --without-http disable HTTP server
  96. --without-http-cache disable HTTP cache
  97. --with-mail enable POP3/IMAP4/SMTP proxy module
  98. --with-mail=dynamic enable dynamic POP3/IMAP4/SMTP proxy module
  99. --with-mail_ssl_module enable ngx_mail_ssl_module
  100. --without-mail_pop3_module disable ngx_mail_pop3_module
  101. --without-mail_imap_module disable ngx_mail_imap_module
  102. --without-mail_smtp_module disable ngx_mail_smtp_module
  103. --with-stream enable TCP/UDP proxy module
  104. --with-stream=dynamic enable dynamic TCP/UDP proxy module
  105. --with-stream_ssl_module enable ngx_stream_ssl_module
  106. --with-stream_realip_module enable ngx_stream_realip_module
  107. --with-stream_geoip_module enable ngx_stream_geoip_module
  108. --with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module
  109. --with-stream_ssl_preread_module enable ngx_stream_ssl_preread_module
  110. --without-stream_limit_conn_module disable ngx_stream_limit_conn_module
  111. --without-stream_access_module disable ngx_stream_access_module
  112. --without-stream_geo_module disable ngx_stream_geo_module
  113. --without-stream_map_module disable ngx_stream_map_module
  114. --without-stream_split_clients_module
  115. disable ngx_stream_split_clients_module
  116. --without-stream_return_module disable ngx_stream_return_module
  117. --without-stream_set_module disable ngx_stream_set_module
  118. --without-stream_upstream_hash_module
  119. disable ngx_stream_upstream_hash_module
  120. --without-stream_upstream_least_conn_module
  121. disable ngx_stream_upstream_least_conn_module
  122. --without-stream_upstream_random_module
  123. disable ngx_stream_upstream_random_module
  124. --without-stream_upstream_zone_module
  125. disable ngx_stream_upstream_zone_module
  126. --with-google_perftools_module enable ngx_google_perftools_module
  127. --with-cpp_test_module enable ngx_cpp_test_module
  128. --add-module=PATH enable external module
  129. --add-dynamic-module=PATH enable dynamic external module
  130. --with-compat dynamic modules compatibility
  131. --with-cc=PATH set C compiler pathname
  132. --with-cpp=PATH set C preprocessor pathname
  133. --with-cc-opt=OPTIONS set additional C compiler options
  134. --with-ld-opt=OPTIONS set additional linker options
  135. --with-cpu-opt=CPU build for the specified CPU, valid values:
  136. pentium, pentiumpro, pentium3, pentium4,
  137. athlon, opteron, sparc32, sparc64, ppc64
  138. --without-pcre disable PCRE library usage
  139. --with-pcre force PCRE library usage
  140. --with-pcre=DIR set path to PCRE library sources
  141. --with-pcre-opt=OPTIONS set additional build options for PCRE
  142. --with-pcre-jit build PCRE with JIT compilation support
  143. --with-zlib=DIR set path to zlib library sources
  144. --with-zlib-opt=OPTIONS set additional build options for zlib
  145. --with-zlib-asm=CPU use zlib assembler sources optimized
  146. for the specified CPU, valid values:
  147. pentium, pentiumpro
  148. --with-libatomic force libatomic_ops library usage
  149. --with-libatomic=DIR set path to libatomic_ops library sources
  150. --with-openssl=DIR set path to OpenSSL library sources
  151. --with-openssl-opt=OPTIONS set additional build options for OpenSSL
  152. --with-debug enable debug logging

目录结构

  1. [root@localhost ~]# tree /usr/local/nginx/
  2. /usr/local/nginx/
  3. ├── client_body_temp
  4. ├── conf ---CGI的配置文件
  5. ├── fastcgi.conf
  6. ├── fastcgi.conf.default ---这个是备份
  7. ├── fastcgi_params
  8. ├── fastcgi_params.default
  9. ├── koi-utf
  10. ├── koi-win
  11. ├── mime.types ---文件的mime类型
  12. ├── mime.types.default
  13. ├── nginx.conf
  14. ├── nginx.conf.default
  15. ├── scgi_params
  16. ├── scgi_params.default
  17. ├── uwsgi_params
  18. ├── uwsgi_params.default
  19. └── win-utf
  20. ├── fastcgi_temp
  21. ├── html
  22. ├── 50x.html
  23. └── index.html
  24. ├── logs
  25. ├── access.log
  26. ├── error.log
  27. └── nginx.pid
  28. ├── proxy_temp
  29. ├── scgi_temp
  30. └── uwsgi_temp