Multisite issues – help would be great!

Hey,

I am using https://github.com/markshust/docker-magento as my Docker container, and I am ripping my hair out trying to understand why it won’t work.

Instance:

Magento Community 2.4.4 running on PHP8.1.6

Image:

markoshust/magento-nginx:1.18-6

images/nginx/conf/default.conf

upstream fastcgi_backend {

server unix:/sock/docker.sock;

}

map $http_host $MAGE_RUN_CODE {

default ”;

domain1.test website_code_domain_1;

}

server {

listen 8000;

return 301 https://$host$request_uri;

}

server {

listen [::]:8443 ssl http2 ipv6only=on;

listen 8443 ssl http2;

server_name magento2.test domain1.test;

ssl_certificate /etc/nginx/certs/nginx.crt;

ssl_certificate_key /etc/nginx/certs/nginx.key;

set $MAGE_ROOT /var/www/html;

set $MAGE_RUN_TYPE website;

fastcgi_buffer_size 64k;

fastcgi_buffers 8 128k;

include /var/www/html/nginx[.]conf;

}

src/nginx.conf

[relevant amends, adding in MAGE_RUN_TYPE & MAGE_RUN_CODE]

…..

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;

fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;

include fastcgi_params;

……

With the above settings and having added entries in /etc/hosts and setting up SSLs and then restarting the container neither URL loads at all. Chrome presents a failed to connect / refused connection error.

However, if I comment out the following from src/nginx.conf:

fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;

fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;

Then magento2.test will load as expected, but loading domain1.test will redirect to the base website of magento2.test

So it seems my variables are not being set / passed on somewhere.

I am quite baffled. Any thoughts on how I could go about troubleshooting this please? I feel I must just be missing 1 critical step somewhere…

submitted by /u/mr_acronym
[link] [comments]