I cloned Directus 8 from github. I run it in my local server. It worked fine without any problems.
Then I uploaded code to AWS Elastic Beanstalk (PHP, apache). but it showed 500 Internal Server Error.
error log: /var/www/html/directus/public/.htaccess: <IfModule not allowed here
I added .ebextensions/setup.config
file to my root folder, like this.
files:
"/etc/httpd/conf.d/enable_mod_rewrite.conf":
mode: "644"
owner: root
group: root
content: |
AllowOverride All
but my Beanstalk said Unsuccessful command execution on instance id(s) 'i-0f6...'. Aborting the operation.
and went to degrading state.
How to fix this?
This answer is for Directus 8 (PHP)
Tried almost all ways of apache settings using .ebextensions and .platform nothing worked.
Then tried NGINX with custom .platform configs. It worked. Answering the steps which I did, may be helpful to someone else, who has the same problem
Directus docs has some configs for NGINEX, go through it
create
nginex.conf
file under.platform/nginx
foldernginex.conf
inside the beanstalk. copy existingnginex.conf
using ssh to ec2 instance and add the custom configs mentioned in the docs and paste it to our newly created.platform/nginx/nginex.conf
below is my custom
.platform/nginx/nginex.conf
nginex.conf
with existingnginex.conf
. (note: we can add the changes only instead of replacing, but it didn't work at the time I tried)