D-Nice
D-Nice

Reputation: 4870

How to disable nginx from elastic beanstalk platform?

I'm switching from nginx to Caddy so I set up Caddy and created a new AMI. When I deploy this AMI to my EB environment, it fails to launch because nginx fails to start during the launch.

Using EB platform Ruby 2.7 running on 64bit Amazon Linux 2, how is it possible to prevent nginx from launching?

Upvotes: 1

Views: 1630

Answers (1)

Transformer
Transformer

Reputation: 7439

If you choose to modify the default AMI, and not create a new one, then ...to override the Elastic Beanstalk nginx configuration, add the following line to your nginx.conf per AWS documentation, do the above "...to pull in the Elastic Beanstalk configurations for Enhanced health reporting and monitoring, automatic application mappings, and static files."

Have a look here... I posted some of those copied sample snippets for you below to walk you through,

  • a) you would setup your daemon by overriding the nginx default config,
  • then b) tell the overridden ngix config to look for Caddys extensions
  • c) and that extension would read its config file

 // this where you over ride nginx config
 include conf.d/elasticbeanstalk/*.conf;
  • a) For e.g. Configuring Apache HTTPD

The Tomcat, Node.js, PHP, and Python platforms allow you to choose the Apache HTTPD proxy server as an alternative to nginx. This isn't the default. The following example configures Elastic Beanstalk to use Apache HTTPD.

Example, here we replace the reverse proxy with apache .ebextensions/httpd-proxy.config (you try caddy)

option_settings:
  aws:elasticbeanstalk:environment:proxy:
    ProxyServer: apache

Background:

By default it ships with Nginx as the reverse proxy on port 80 to find your app. on EBS. So, you have two options a 1) new Custom AMI or 2) Modifying your AMI

"...Proxy configuration files provided in the .ebextensions/nginx directory should move to the .platform/nginx platform hooks directory. For details, expand the Reverse Proxy Configuration section in Extending Elastic Beanstalk Linux platforms."

Then look at predeploy and postdeploy config options here

Elastic Beanstalk Configuration

Upvotes: 2

Related Questions