Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By alisamar on
Basically, I want to create a structure as follows:
Main site
/var/www/mainsite.com/master/src/
Sub-sites
- /usr/local/subsites/_site1/src/
- /usr/local/subsites/_site2/src/
- /usr/local/subsites/_site3/src/
and these sub-sites should be accessible as follows:
- mainsite.com/site1
- mainsite.com/site2
- mainsite.com/site3
All sites completely separate drupal systems and they all have different databases and sources.
I tired the reverse proxy setup with perusio configuration but it seems that is not working properly, User login does not work and There are some broken links.
Main site configuration
server {
listen 80; # IPv4
server_name mainsite.com;
limit_conn arbeit 32;
## Access and error logs.
access_log /var/log/nginx/mainsite.com_access.log;
error_log /var/log/nginx/mainsite.com_error.log;
## See the blacklist.conf file at the parent dir: /etc/nginx.
## Deny access based on the User-Agent header.
if ($bad_bot) {
return 444;
}
## Deny access based on the Referer header.
if ($bad_referer) {
return 444;
}
## Protection against illegal HTTP methods. Out of the box only HEAD,
## GET and POST are allowed.
if ($not_allowed_method) {
return 405;
}
location /site1/ {
proxy_pass http://site1.mainsite.com/;
proxy_redirect http://site1.mainsite.com/ http://mainsite.com/site1/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
root /var/www/mainsite.com/master/src/;
index index.php;
## If you're using a Nginx version greater or equal to 1.1.4 then
## you can use keep alive connections to the upstream be it
## FastCGI or Apache. If that's not the case comment out the line below.
fastcgi_keep_conn on; # keep alive to the FCGI upstream
## Uncomment if you're proxying to Apache for handling PHP.
#proxy_http_version 1.1; # keep alive to the Apache upstream
################################################################
### Generic configuration: for most Drupal 7 sites.
################################################################
include apps/drupal/drupal.conf;
#################################################################
### Support for upload progress bar. Configurations differ for
### Drupal 6 and Drupal 7.
#################################################################
include apps/drupal/drupal_upload_progress.conf;
} # HTTP server
sub-site settings.php
$base_url = 'http://mainsite.com/site1';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('127.0.0.1');
How can I make this work?