Error 502 Bad Gateway

I’m working with Pimcore 6.7 in the Docker container.

On the local machine it’s working, but when I deploy to AWS, it doesn’t work.

It shows this message: 502 Bad Gateway
In log shows “GET /app.php” 500

Does anyone have any experience with this problem?

make sure you have writable permission to var/ and web/var

After allowing valid permission you can clear cache by command -

bin/console cache:clear

This also didn’t work. In log shows this message:

2020-09-10T10:16:26.367Z [10-Sep-2020 10:16:26] NOTICE: fpm is running, pid 1

2020-09-10T10:16:26.377Z [10-Sep-2020 10:16:26] NOTICE: ready to handle connections

2020-09-10T10:16:49.613Z 172.17.0.5 - 10/Sep/2020:10:16:45 +0000 “GET /app.php” 500

2020-09-10T10:16:49.613Z 172.17.0.5 - 10/Sep/2020:10:16:45 +0000 “GET /app.php” 500

2020-09-10T10:17:15.695Z 172.17.0.5 - 10/Sep/2020:10:17:15 +0000 “GET /app.php” 500

2020-09-10T10:17:15.695Z 172.17.0.5 - 10/Sep/2020:10:17:15 +0000 “GET /app.php” 500

2020-09-10T10:17:45.674Z 172.17.0.5 - 10/Sep/2020:10:17:45 +0000 “GET /app.php” 500

2020-09-10T10:17:45.674Z 172.17.0.5 - 10/Sep/2020:10:17:45 +0000 “GET /app.php” 500

2020-09-10T10:18:02.985Z [10-Sep-2020 10:18:02] NOTICE: Finishing …

2020-09-10T10:18:02.993Z [10-Sep-2020 10:18:02] NOTICE: exiting, bye-bye!

I am using environment variables for database connections. When I run the composer install, Pimcore continues to read the old variables and does not recreate the cache with the new values.

In EnvVarProcessor.php line 171:

Environment variable not found: “PIMCORE_DB_HOST”.

I changed variables in database.yml to PIMCORE_DB_HOST_DEV2, but in var\cache\prod\Container1Y2gMz1\appAppKernelProdContainer.php continues with old variables.

Before using environment variables you must clear the cache any changes in env or yml file require bin/console cache:clear

Try adding database details app/config/local/database.yml if environment variables are not working.