I'm using Drupal 8, with multi-site setup, located at "/var/www/html/drupal" directory and I'm using NGINX as web-server.
I've following domain names :
- qa.example.com
- qa.example.com/v1
- qa.example.com/v2
Where "qa.example.com" is main domain serving static file (index.html with some info in it). And v1 and v2 are dynamic sites created using Drupal 8 Multi-site.
Since qa.example.com has only 1 static file, I've placed it in Drupal Core directory and pointed virtual host to "/var/www/html/drupal" directory. As per documentation available in examples.sites.php, I've added sites entry in sites.php as below:
<?php
$sites['qa.example.com.v1'] = 'v1.example.com';
$sites['qa.example.com.v2'] = 'v2.example.com';
When accessing "qa.example.com" it works fine as it has only single index.html file, but when accessing "qa.example.com/v1", I'm being redirected to "qa.example.com/core/install.php" or receiving "404 Not Found" nginx page. I'm not understanding what I'm missing.
Following is NGINX config I'm using :
server {
server_name qa.example.com;
listen 80;
listen [::]:80;
index index.php index.html;
location / {
root /var/www/html/drupal;
try_files $uri /index.php?$query_string;
}
location /v1 {
root /var/www/html/drupal;
# try_files $uri $uri/ /var/www/html/drupal/index.php?$query_string;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ \..*/.*\.php$ {
return 403;
}
location ~ ^/sites/.*/private/ {
return 403;
}
location ~ (^|/)\. {
return 403;
}
location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ '\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
include fastcgi_params;
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ ^/sites/.*/files/styles/ {
try_files $uri @rewrite;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
Following is the directory structure I've:
// main directory
/var/www/html/drupal
// my static file for landing domain name
/var/www/html/drupal/index.html
// drupal core files
/var/www/html/drupal/core
// drupal's index.php file
/var/www/html/drupal/index.php
// contrib and custom modules
/var/www/html/drupal/modules
// Site v1 directory as per Drupal's multi-site directory structure.
/var/www/html/drupal/sites/v1
// Site v2 directory as per Drupal's multi-site directory structure.
/var/www/html/drupal/sites/v2
I've looked into many references online, but nothing is working.
NOTE : v1 and v2 are not actual directory "/var/www/html/drupal".
Following are links which I've referred :