Skip to content

Instantly share code, notes, and snippets.

@scgoeswild
Created February 10, 2022 04:36
Show Gist options
  • Save scgoeswild/dac447b1a5c9d4608dacb12be3631c6e to your computer and use it in GitHub Desktop.
Save scgoeswild/dac447b1a5c9d4608dacb12be3631c6e to your computer and use it in GitHub Desktop.
Magento2 setup apache2 multiwebsite
SetEnvIf Host ^(.)mcstaging.50-ml.it MAGE_RUN_CODE=IT
SetEnvIf Host ^(.)mcstaging.50-ml.it MAGE_RUN_CODE=EN
<VirtualHost *:80>
ServerName mcstaging.domain.it
SetEnv MAGE_RUN_CODE "IT"
SetEnv MAGE_RUN_TYPE "website"
ServerAdmin serveradmin@domain.it
DocumentRoot /home/production
ErrorLog ${APACHE_LOG_DIR}/domain-error.log
CustomLog ${APACHE_LOG_DIR}/domain-access.log combined
<Directory /home/production>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
# 2.4.10+ can proxy to unix socket
SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
<VirtualHost *:80>
ServerName mcstaging.domain2.it
SetEnv MAGE_RUN_CODE "EN"
SetEnv MAGE_RUN_TYPE "website"
ServerAdmin serveradmin@domain.it
DocumentRoot /home/production
ErrorLog ${APACHE_LOG_DIR}/domain2-error.log
CustomLog ${APACHE_LOG_DIR}/domain3-access.log combined
<Directory /home/production>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
# 2.4.10+ can proxy to unix socket
SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment