Reputation: 437
I have an old django project setup with elastic beanstalk using a .ebextensions folder. This old project contains many files, some of which update Apache by putting configuration files into the following location:
/etc/httpd/conf.d/
For example, it would add an enable_mod_deflate.conf by having the following command in one of the .ebextensions configuration files:
container_commands:
01_setup_apache:
# Setup gzip compression on apache server by copying enable_deflate.conf into appropriate directory.
command: "cp .ebextensions/enable_mod_deflate.conf /etc/httpd/conf.d/enable_mod_deflate.conf"
Similarly there is a file for cache configuration that looks something like this:
files:
"/etc/httpd/conf.d/enable_cache.conf":
mode: "000444"
owner: root
group: root
content: |
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 day"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month”
ExpiresByType application/javascript "access plus 1 month”
ExpiresByType image/ico "access plus 1 month"
ExpiresByType text/html "access plus 600 seconds"
</IfModule>
The problem that I have is that I have just tried to create another Django project. When I ssh into the old ec2 instance (I am using a single instance elastic beanstalk environment), I can see all of the files in the /etc/httpd/conf.d/ directory. However when I use the new elastic beanstalk environment and look in the /etc/httpd/conf.d directory, none of the configuration files are created.
Its almost like AWS has changed elastic beanstalk so that it cannot copy to the conf.d directory.
I have downloaded the logs and cannot find anything to explain why the copy has stopped working.
It was over a year ago when I setup the original Django project, so I may be wrong about this, but it has an option to select nginx as the server, so I had to specifically pick Apache. It feels like something has changed.
Does anybody have any idea's about why this isn't working and what I can do about it ?
Upvotes: 0
Views: 917
Reputation: 238131
You are using configuration files for httpd
("/etc/httpd/conf.d/enable_cache.conf
) based on Amazon Linux 1 (AL1). However, for EB platform based on AL2, proxy httpd
is setup differently then on AL1. Specifically, they should be in .plaftorm
folder, not .ebextentions
. From docs:
Configuration file location – You should place proxy configuration files in the .platform/nginx and .platform/httpd directories on all Amazon Linux 2 platform versions.
Further details how to setup httpd
on AL2 platforms are in Configuring Apache HTTPD.
Upvotes: 4