参考资料

  1. Nginx如何用于反向代理?
  2. Nginx expires、etag、if_modified_since:客户端缓存控制详细说明以及案例
  3. 如何配置Nginx反向代理?
  4. Nginxrewrite重定向配置详解
  5. PHP-FPM 性能优化
  6. nginx 防止各种攻击
  7. OpenResty编译安装详细说明以及案例
  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 的默认配置文件路径。

声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。