0

I have a server which I want to run drupal site on it.

The default http port 80 was block and it does not have a static IP address. I have to run Drupal on non 80 port, let's say 8765.

Since I do not have a static IP, I apply a sub-domain name from noip which is drupal8.myftp.org. So finally my domain name should be drupal8.myftp.org:8765

First, I read the tutorial here

From line 46

  • Note that if you are installing on a non-standard port number, prefix the

  • hostname with that number. For example,

  • www.drupal.org:8080/mysite/test/ could be loaded from

  • sites/8080.www.drupal.org.mysite.test/.**

So In my scenario, I should create a directory like sites/8765.drupal8.myftp.org/ and put the settings.php here. Then I also need to create a 8765.drupal8.myftp.org.php file under “sites” directory to tell Drupal to looking for the settings.php within sites/8765.drupal8.myftp.org directory.

I did create the directory and the file.

But Drupal still looking for the settings.php under default directory, why?

Questoin1: what content should be in the 8765.drupal8.myftp.org.php file? Since I can not find any tutorial about this, I just leave it blank, I assume it's just a symbol to let Drupal know it should look for the settings.php in the 8765.drupal8.myftp.org category.

Question2: Why Drupal doesn't look for the settings.php under 8765.drupal8.myftp.org directory? Do I did sth wrong?

Since I need to add

$base_url=”http://drupal8.myftp.org:8765

in the settings.php and the file under sites/8765.drupal8.myftp.org directory doesn't work. So I have to add it to the settings file under default directory. But still, If I open the site drupal8.myftp.org:8765 and view the source code

<link rel="shortcut icon" href="http://drupal8.myftp.org/core/misc/favicon.ico" type="image/vnd.microsoft.icon" />
<link rel="alternate" hreflang="en" href="http://drupal8.myftp.org/node/3" />
<link rel="alternate" hreflang="zh-hans" href="http://drupal8.myftp.org/zh-hans/node/3" />

We can see all the link are still point to drupal8.myftp.org, therefore, all image and css info are gone.

So could anybody give me some instructions, I have be stuck in this for three days, any help is highly appreciated.

Thanks in advance.

@Pathak,

Thank you for your kind reply.

Yes, I create a folder called 8765.drupal8.myftp.org and place settings.php within it. So the path is

sites/8765.drupal8.myftp.org/settings.php

I also create a file call 8765.drupal8.myftp.org.php reference to example.sites.php.

The path is

sites/8765.drupal8.myftp.org.php

According to example.sites.php

The array is written in the format: '..' => 'directory'. As an example, to map www.drupal.org:8080/mysite/test to the configuration directory sites/example.com, the array should be defined as:

$sites = array( '8080.www.drupal.org.mysite.test' => 'example.com', );

Then in the 8765.drupal8.myftp.org.php, I write the $sites array as follow;

$sites = array(
    '8765.drupal8.myftp.org' => '8765.drupal8.myftp.org',
  );

But still, if open the site drupal8.myftp.org:8765, the settings.php under the default directory was read. All links are point to drupal8.myftp.org without the port number. Could you please point out on which step I was wrong?

2

All of those instructions only apply if you actually want to have a multi-site installation and e.g. different installations on different ports. Something that most people recommend to not do as it results in maintenance issues sooner or later.

If you just want to have one installation, use sites/default/settings.php and you're good to go.

0

If you are creating a new folder and placing settings.php there as well, Drupal will treat your site as a multisite installation. So all you need to do is look into 'sites/example.sites.php'. Copy it to 'sites.php' and create an array $sites mapping default and your custom site folder as well.

0

I believe you are having two problems, although it might be only one.

First of all, are you planning to use this Drupal installation as a multisite installation, i.e. are you planning on serving multiple sites from the one code base?

If not, than you do not need to do any of that. Drupal will use the sites/default directory by default when it gets to serve a request. Running it off a non-standard port is handled completely by the web server and is a non-issue, as far as Drupal is concerned. So, you might just be making things hard on your self, by not following the multisite instructions correctly (see further).

So, if you're not planning on using multisite (and I would like to add, think carefully if you think you do - as Berdir is saying, it can be very limiting and can really only be recommended in very specific circumstances), stop here. Rename your site directory to default (and/or merge it with the standard one); if your requests are not ending up at Drupal, your problems are more likely with your web server.

If you really do want multisite, note that the instructions do not tell you to create a 8765.drupal8.myftp.org.php file. You need a 8765.drupal8.myftp.org directory (actually, the directory doesn't even need to be called that, you can map it in the sites.php file). Within the directory, you need a settings.php file, which you can base off of settings.default.php in the default directory. To point Drupal to that directory, you need the sites.php file (in the sites/ directory, so not in your site subdirectory). If you named the directory as you did, that's all you need; Drupal should be able to find the site directory based on the naming, provided you are accessing the site with that domain name and that port. If you chose to give the directory a different name (e.g. just myftp), you can map the site to the directory:

$sites = array(
  '8765.drupal8.myftp.org' => 'myftp', 
);

Note that to use the Drupal multisite feature (which includes having Drupal use a directory other that sites/default for a particular site), you do need the sites.php file, but if you named your directory appropriately, you don't need to add the mapping in the $sites array within it; the instructions are actually not very clear, in that regard,

But again, if you do not need multiple sites to be served from the same Drupal directory (and basically I would recommend against that), you don't need to do all that, Drupal will be fine running with the sites/default directory, regardless of the port that's being used by the web server.

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.