Subdomain with symlink — two kinds of failure

Problem Description

I have a multisite WordPress installation. the main site runs off a plain domain, call it domain.com. The other site runs on a subdomain, say sub.domain.com. I had this all working fine on another server using Symbiosis, so I don’t think there’s any problem with the WP side of things. And the main site is still running running perfectly well on its new server.

DNS records for the main domain and the subdomain are correctly pointing to the new server. I made the subdomain on the server by creating these directories and links:

/srv/sub.domain.com
/srv/sub.domain.com/public
/srv/sub.domain.com/public/htdocs -> /srv/domain.com/public/htdocs

When I run sympl-web-configure, a symlink is created:

/etc/apache2/sites-enabled/sub.domain.com.conf -> /etc/apache2/sites-available/sub.domain.com.conf

Any Error Messages

If I leave the sites-enabled symlink in place, then when I try to acces the subdomain, the browser page is blank, and I get this kind of thing in the subdomain’s error.log:

[Mon Dec 14 15:51:45.384644 2020] [php7:warn] [pid 18744] [client XX.XX.XX.XX:XXXXX] PHP Warning:  Unknown: open_basedir restriction in effect. File(/srv/domain.com/public/htdocs/index.php) is not within the allowed path(s): (/srv/sub.domain.com/public/:/srv/sub.domain.com/php_tmp/:/srv/sub.domain.com/php_sessions/) in Unknown on line 0

Obviously open_basedir isn’t noticing that it’s actually the same directory. But, there is no SSL warning when I try https://sub.domain.com, so I think the certificate is properly installed.

Removing the sites-enabled symlink and restarting apache allows the subdomain to be displayed in a browser, and those error messages go away — but SSL doesn’t work. When I try to look at https://sub.domain.com I get a warning that the certificate refers only to the server’s default domain, with no mention of domain.com anywhere.

Any help would be very gratefully received.

Thanks,
Ben

Environment

  • Sympl Version : 10
  • Debian Version : Buster
  • Hosted On? Bytemark

Hi Ben,

You’re hitting some of the PHP security things, which cause issues with the WordPress webroot being in unexpected places.

The simplest fix is to create /srv/example.com/config/disable-php-security and run sudo sympl-web-configure, it should disable the PHP open_basedir restrictions, and allow the sites to use the alternate path.

This is a known issue at the moment, and something that will be fixed in a future version of sympl-web, as it needs a bit of work to identify all of the actual filesystem targets and ensure they are valid.

Just to add…

Without the configuration there with the cert, if fails over to the ‘Mass Hosting’ configuration, but that only has the default fall-back SSL certificate for the server itself, so it will serve the content fine, (although without the PHP open_basedir restriction, as the site files could be in any number of locations in /srv).

Thank you very much for this hint, it done the job! It’s always comforting to find that I wasn’t being a complete idiot.

Thanks,
Ben

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.