nginxinc/nginx-amplify-agent

nginx_config failed to parse /etc/nginx/conf.d/default.conf due to: NgxParserDirectiveContextError

Danrancan opened this issue · 1 comments

In my amplify web interface I am getting the same error for many nginx virtual host .conf files:

Agent could not parse nginx config file
nginx-1.25.1 @ example.com
nginx-1.25.1 @ mail.example.com
Agent could not parse nginx config failed to parse /etc/nginx/conf.d/01-mail.example.com.conf due to: NgxParserDirectiveContextError
Agent could not parse nginx config failed to parse /etc/nginx/conf.d/01-example.com.conf due to: NgxParserDirectiveContextError

In my Nginx error logs I am getting the following errors for multiple virtual hosts:

nginx_config failed to parse /etc/nginx/conf.d/default.conf due to: NgxParserDirectiveContextError
nginx_config failed to parse /etc/nginx/conf.d/01-example.com.conf due to: NgxParserDirectiveContextError
nginx_config failed to parse /etc/nginx/conf.d/01-mail.example.comf due to: NgxParserDirectiveContextError

What could be causing these errors, and how can I debug and fix them?
Thanks

@Danrancan were you able to solve this ?
“VirtualHost” is an Apache term. NGINX does not have Virtual hosts, it has “Server Blocks” that use the server_name and listen directives to bind to tcp sockets.
Take a look to an example https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/ pertaining to configs.

By seeing error, it seems directives in config are not correctly used in a context e.g. ('events',) ('http', 'server')