markshust / docker-magento

Mark Shust's Docker Configuration for Magento
https://m.academy/courses/set-up-magento-2-development-environment-docker/
MIT License
2.54k stars 999 forks source link

unknown "mage_run_code" variable #996

Open Dramorian opened 12 months ago

Dramorian commented 12 months ago

Description https://courses.m.academy/courses/487758/lectures/14780970 When trying to configure a multi-store instance, I get the error in nginx app container unknown "mage_run_code" variable

Steps To Reproduce

  1. Follow the video

Expected Result Both websites working which are set in images/nginx/conf/default.conf

Actual Result Ubuntu terminal giving this error: /compose.yaml: yaml: line 12: did not find expected key

Docker app container log this one: [emerg] 1#1: unknown "mage_run_type" variable

If you comment out these lines, it works as usual, but apparently it doesn't let me access my second website and instead redirects to the default one.

fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;

fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;

I use Windows 10 and WSL2.

markshust commented 9 months ago

Can you post your full compose.yaml file?

This error is telling:

/compose.yaml: yaml: line 12: did not find expected key

I'd recommend fixing one error at a time, as fixing one thing could resolve others. The error above is leading to an invalidly formatted YAML file.

emp1211 commented 8 months ago

I'm experiencing a very similar issue. Local AC instance working fine when the following lines are commented out of the nginx.conf: fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE; fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;

STEPS TAKEN / STEPS TO REPRODUCE -starting from working docker-magento instance, following Mark's video: -compose.yml - replaced with image command with build command -/images/nginx/Dockerfile created & configured -/images/nginx/conf/default.conf created & configured -nginx.conf updated with MAGE_RUN_CODE and MAGE_RUN_TYPE vars -compose.dev.yml updated to bind-mount nginx.conf instead of nginx.conf.sample -run setup ssl command

EXPECTED RESULT -additional websites in magento instance are hit by the browser at correct URLs

ACTUAL RESULT -app (nginx) container fails/crashes - log returns unknown "mage_run_type" variable -if those lines mentioned above are commented out, app (nginx) container working but redirecting to base URL

Is this a known issue? Are there any known fixes? It seems like it may be a permissions issue.

craig-bartlett commented 3 months ago

I had a similar issue as above, but found that the images/nginx/conf/default.conf was not copying over - verified by checking the /etc/nginx/conf.d/default.conf file in the app container. I rebuilt the image from the Dockerfile with:

docker build --pull --rm -f "images/nginx/Dockerfile" -t magento:latest "images/nginx"

And found an error had been thrown due to a typo in the images/nginx/Dockerfile. After I corrected this and rebuilt the container the problem was solved.