2

I'm trying to configure the server like this have this accessible addresses:

domain.com/webmail (webmail app)
domain.com/app (node.js app)
domain.com/mailadmin (mail administration app)
domain.com/site (drupal website)

My Root diretory is /var/www

which has the following directories:

/var/www/webmail
/var/www/app
/var/www/postfixadmin
/var/www/site

I have tried several configurations and none of them worked (some worked partially, showing the homepage or showing all pages but without any CSS styles)

Cheers

1

After two spending all day on this. I finally found a fully working solution:

  1. First you need change the location / (Catch all) so it doesn't try to fetch subdirectories
  2. Then you need to create a location /subfolder_name/ for each app you want to have served
  3. Finally you need to configure the drupal location and a rewrite so it catches the requests of /drupal_subfolder/ and rewrites it for the Drupal router.

So here's the code:

location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri =404;
    }

    location /app/ {
         // reverse proxy configuration of a node.js app
         ...
    }

    location /webmail/ {

    }

    location /mailadmin/ {

    }

    location @drupal_rewrite {
            rewrite ^/site/(.*)$ /site/index.php?$1;
    }

    location /site/ {
            try_files $uri @drupal_rewrite;
    }

In my configuration (above) only the location /app/ and location /site/ blocks have content.

Hope it helps someone. :)

(I used: ubuntu + nginx + drupal 8.2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.