I\'m developing with django on elastic beanstalk and I want to make two changes to apache configuration:
1. redirect www.domain.com to domain.com
2. redirect
This is very well explained in AWS documentation as below:
To extend the Elastic Beanstalk default Apache configuration, add .conf configuration files to a folder named .ebextensions/httpd/conf.d in your application source bundle. The Elastic Beanstalk Apache configuration includes .conf files in this folder automatically.
~/workspace/my-app/
|-- .ebextensions
| -- httpd
| -- conf.d
| -- myconf.conf
| -- ssl.conf
-- index.jsp
To override the Elastic Beanstalk default Apache configuration completely, include a configuration in your source bundle at .ebextensions/httpd/conf/httpd.conf.
~/workspace/my-app/
|-- .ebextensions
| `-- httpd
| `-- conf
| `-- httpd.conf
`-- index.jsp
If you override the Elastic Beanstalk Apache configuration, add the following lines to your httpd.conf to pull in the Elastic Beanstalk configurations for Enhanced health reporting and monitoring, response compression, and static files.
IncludeOptional conf.d/*.conf
IncludeOptional conf.d/elasticbeanstalk/*.conf
Note
To override the default listener on port
80, include a file named00_application.confat.ebextensions/httpd/conf.d/elasticbeanstalk/to overwrite the Elastic Beanstalk configuration.
For a working example, take a look at the Elastic Beanstalk default configuration file at /etc/httpd/conf/httpd.conf on an instance in your environment. All files in the .ebextensions/httpd folder in your source bundle are copied to /etc/httpd during deployments.
Further details can be seen on this link under Extending and overriding the default Apache configuration. Better to use correct approach instead of patches or workarounds.