参考资料

  1. nginx反向代理配置详解
  2. Service Worker文件如何更新?
  3. Nginx处理HTTP请求详细说明以及案例
  4. Nginx基于FastCGI实现负载均衡详细说明以及案例
  5. Nginx端口监听(listen指令)详细说明以及案例
  6. Cache-Control头设置max-age和immutable属性
  7. NginxWebDAV模块配置详细说明以及案例
  8. Nginx的负载均衡能力

要查看 Nginx 默认配置文件路径,可以使用以下命令:

  1. 使用 nginx -t 命令测试配置文件并显示路径:

    nginx -t

    输出中会显示配置文件的路径,例如:

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
  2. 使用 nginx -V 命令查看编译参数,其中包含配置文件路径:

    nginx -V

    输出中会显示 --conf-path 参数,例如:

    --conf-path=/etc/nginx/nginx.conf
  3. 默认情况下,Nginx 的配置文件通常位于以下路径之一:

    • /etc/nginx/nginx.conf

    • /usr/local/nginx/conf/nginx.conf

    • /usr/local/etc/nginx/nginx.conf

通过这些方法,你可以找到 Nginx 的默认配置文件路径。