Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Danrancan opened this issue Jul 18, 2023 · 1 comment

Comments

@Danrancan
Copy link

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

@achawla2012
Copy link

achawla2012 commented Sep 29, 2023

@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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants