본문 바로가기
컴퓨터 활용(한글, 오피스 등)/50_2.운영체제_리눅스

리눅스_drupal 설치_Port in a micro site URL not supported

by 3604 2022. 12. 1.
728x90

Port in a micro site URL not supported

Steps to reproduce:

1. Create 2 Apache virtual hosts:

<VirtualHost *:8087>
    DocumentRoot "/Users/myuser/sites/drupal-micro_site/web"
    ServerName micro.site
    ServerAlias www.micro.site
    ErrorLog "/usr/local/var/log/httpd/sites.local-error_log"
    CustomLog "/usr/local/var/log/httpd/sites.local-access_log" common
    DirectoryIndex index.php
    <Directory "/Users/myuser/sites/drupal-micro_site/web">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:8087>
    DocumentRoot "/Users/myuser/sites/drupal-micro_site/web"
    ServerName site-one.com
    ServerAlias www.site-one.com
    ErrorLog "/usr/local/var/log/httpd/sites.local-error_log"
    CustomLog "/usr/local/var/log/httpd/sites.local-access_log" common
    DirectoryIndex index.php
    <Directory "/Users/myuser/sites/drupal-micro_site/web">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

2. Add the following in the /etc/hosts file:

127.0.0.1  micro.site
127.0.0.1  site-one.com

3. Install a fresh Drupal installation with composer:

composer create-project drupal/recommended-project drupal-micro_site --no-interaction

Install micro_site and micro_node with composer:

composer require drupal/micro_site
composer require drupal/micro_node

Enable micro_site and micro_node

4. Add the following code in settings.php:

$dir_hosts = $app_root . '/' . $site_path . '/hosts';
if (file_exists($dir_hosts) && is_dir($dir_hosts)) {
  foreach (glob($dir_hosts . '/*.host.php') as $filename) {
    include $filename;
  }
}

5. Add the base URL, the base scheme and the public URL in /admin/config/micro_site/settings

6. Rebuild permissions

7. Add a site type "Generic" in /admin/structure/sites/add

8. Add a registered site "Site One" in /admin/content/site

9. Get the following:

While ping site-one.com is OK.
I'm wondering if using a different port from 80 could cause the issue (I can't test it on my machine).

728x90
반응형