宝塔错误ERROR: nginx: [emerg] open nginx: configuration file /www/server/nginx/conf/nginx.conf test failed

添加规则显示错误

ERROR:
nginx: [emerg] open() "/www/server/nginx/conf/snippets/fastcgi-php.conf" failed (2: No such file or directory) in /www/server/panel/vhost/rewrite/img.qjfyx.com.conf:32
nginx: configuration file /www/server/nginx/conf/nginx.conf test failed
  • 网上说安装模块–add-module=src/ngx_devel_kit --add-module=src/lua_nginx_module,不起作用,如想安装编辑文件‘ /www/server/panel/install 找到文件nginx.sh’,在336行增加模块
--add-module=${Setup_Path}/src/ngx_devel_kit --add-module=${Setup_Path}/src/lua_nginx_module
./configure --user=www --group=www --prefix=${Setup_Path} ${ENABLE_LUA} --add-module=${Setup_Path}/src/ngx_cache_purge ${ENABLE_STICKY} --add-module=${Setup_Path}/src/ngx_devel_kit --add-module=${Setup_Path}/src/lua_nginx_module --with-openssl=${Setup_Path}/src/openssl --with-pcre=pcre-${pcre_version} ${ENABLE_HTTP2} --with-http_stub_status_module --with-http_ssl_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --add-module=${Setup_Path}/src/ngx_http_substitutions_filter_module-master --with-ld-opt="-Wl,-E" --with-cc-opt="-Wno-error" ${jemallocLD} ${ENABLE_WEBDAV} ${ENABLE_NGX_PAGESPEED} ${ADD_EXTENSION} ${i_make_args}

这是检测到配置文件有错误,请先排除后再操作

删除带 fastcgi-php.conf规则就行。