0

Example:

www.domain1.com -> Drupal site in root dir (Managed by Apache)

www.domain2.com/usa -> Drupal site of domain1.com (Managed by Nginx)

The idea is that www.domain2.com/<countrycode> points to the real domain but in a transparent way (User must not see the existence of the real domain).

What I did:

1) Configured nginx as reverse proxy:

## HTTP server.                                                          
server {                                                                 
    listen 80; # IPv4                                                    

    server_name emed.com, www.emed.com;                                  

    access_log /var/log/nginx/drupal.log;                                
    error_log /var/log/nginx/drupal.log;                                 

    keepalive_timeout 75 75;                                             

    root /opt/www/web/drupal;                                            
    index index.php;                                                     

    include apps/drupal/drupal.conf;                                     

    location /fr/ {                                                      
        proxy_set_header Host $host;                                     
        proxy_pass http://localhost:8080/fr/;                            
        proxy_redirect http://localhost:8080/fr/ http://www.emed.com/fr/;
    }                                                                    

}                                                                        

2) Configured Apache

<VirtualHost *:8080>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
        Alias "/fr" "/var/www/html/drupal7"
</VirtualHost>      

The problem is that Apache must have the Alias fr directive, otherwise Drupal generates incorrect URLs:

www.domain2.com/usa tries to load assets from www.domain2.com/sites/... instead of www.domain2.com/usa/sites/...

Is this even possible withouth using Alias? Because the first domain serves on / (root)

-1

I think you have to check this module https://www.drupal.org/project/domain it has the solution for this

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.