安装模块 为了 apache 和 nginx 它需要更改配置文件。 nginx.conf,就我们而言。
对于新手用户,更改一些线路和 nginx.conf 中的指令 这可能是极限运动,特别是如果我不明白积木是如何工作的 nginx。
错误 “nginx:[出现] “load_module” 指令在nginx.conf中指定为时已晚” 在安装 NGINX 模块后添加该模块时最常见。它的解决方案非常简单,我们只需将模块行放在 nginx.conf 的上部即可。
与其他配置文件相比,NGINX 按照 nginx.conf 文件中传递的指令、定义和条件的顺序执行它们。
一个具体的例子。如果我们安装 Brotli模块 对于NGINX,模块加载行必须紧接在NGINX进程ID之后,以便以下特定行考虑这些模块并且进程正确运行。
user nginx;
worker_processes 2;
pid /var/run/nginx.pid;
load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
events {
worker_connections 1024;
}
....
更改模块加载行的位置后,执行命令 nginx -t 在 SSH 中确保一切正常并且没有其他错误。重新启动 NGINX 服务以使 nginx.conf 中的更改生效。