• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Change open_base_dir for ssl subdomain

vanlier

New Pleskian
We migrated from plesk 7 for linux to a new server with plesk 8.3.0 for linux. One of our customers had the following domain set up:

normal website: http://www.<domain>
admin website: https://beheer.<domain>

The normal website doesn't use ssl, just plain http. To change their dynamical website they go to a subdomain that uses ssl en log in there with a username and password. This worked on the old server but on the new server they get an error stating the open_base_dir problem: they upload pictures from the ssl subdomain to a folder (/httpdocs/images/logos/) on the non-sll normal website and that folder isn't in the base_dir configuration.

I've tried 100 thing to change the open_base_dir for the ssl_subdomain but it simply does not work. I tried creating a vhost.conf in the /conf dir with the following directives:

<Directory /var/www/vhosts/<domain>/subdomains/beheer/httpsdocs>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/<domain>/httpdocs:/var/www/vhosts/<domain>/subdomains/beheer/httpsdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/<domain>/httpdocs:/var/www/vhosts/<domain>/subdomains/beheer/httpsdocs:/tmp"
</IfModule>
</Directory>

Then I ran "/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain> -r" to apply the changes. That didn't work. I made a document with the phpinfo() command and that still displayed the old value. I could have know because if I look at /conf/http.include I can see the vhost.conf is included in the configuration for the <ip>:80 section. I renamed it to vhost_ssl.conf and ran the reconfigure command again. Still no luck. I suppose the configuration files only work for the main website and not the subdomains.

I read somewhere I had to create a vhost.conf in the /subdomains/beheer/conf folder but that didn't exist. I created it and made a vhost.conf there. Again reran the reconfigure command again. No luck. I renamed it to vhost_ssl.conf (I really knew it was going to work now!!! ;)) but........ no changed open_base_dir.

As a last resort I tried creating a file called zzzz_custom_http.conf in the /etc/httpd/conf.d folder. All .conf files in here are being parsed and because of zzzz_custom it will be parsed as the last file. I entered the statements below:

<VirtualHost <ip>:443>
ServerName beheer.<domain>:443
<Directory /var/www/vhosts/<domain>/subdomains/beheer/httpsdocs>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/<domain>/httpdocs:/var/www/vhosts/<domain>/subdomains/beheer/httpsdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/<domain>/httpdocs:/var/www/vhosts/<domain>/subdomains/beheer/httpsdocs:/tmp"
</IfModule>
</Directory>
</Virtualhost>

Deleted the vhost_ssl.conf and the conf dir from the subdomain and reran the reconfigure command again. And stil...... no luck? What am I doing wrong????
 
SOLVED!!!!!!!!!

I saw after some more trying that my httpd.include now included the following line:

<VirtualHost <ip>:443>
ServerName beheer.<domain>:443
......
......
Include /var/www/vhosts/<domain>/subdomains/beheer/conf/vhost.conf
</VirtualHost>

So this was 1 step forward. At least now I could adjust the configuration for the ssl site (not sure why vhost_ssl.conf) does not work, the same line is included in the :80 virtual host so this means I can't make changes for just the ssl site but always for both ssl and none ssl).

I changed the vhost.conf (in the /var/www/vhosts/<domain>/subdomains/beheer/conf folder) so it contains only the following:

<Directory /var/www/vhosts/<domain>/subdomains/beheer/httpsdocs>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_value open_basedir "/var/www/vhosts/<domain>/subdomains/beheer/httpsdocs:/var/www/vhosts/<domain>/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_value open_basedir "/var/www/vhosts/<domain>/subdomains/beheer/httpsdocs:/var/www/vhosts/<domain>/httpdocs:/tmp"
</IfModule>
</Directory>

And now it works!!!!
 
vanlier

Whats did you do to force the httpd.include file to "include" your subdomain vhosts.conf file (see below). try as I might, i cannot get it to include.

Include /var/www/vhosts/<domain>/subdomains/beheer/conf/vhost.conf
 
I created the folder 'conf' in the /subdomains/beheer/ folder. In that folder I created a 'vhost.conf'. After that run "/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain> -r". It should see the vhost.conf exists and add the include line to
 
Ah, that doesn't work for me. :-(


It works to create an include directive for the top level domain. But it doesn't create an Include for the sub-domain

So in my

/var/www/vhosts/{domain}.co.uk/conf/httpd.include

I have the following......

<VirtualHost 1.2.3.4>
Top Level Domain Stuff
Include /var/www/vhosts/{domain}.co.uk/conf/vhost.conf
</VirtualHost>

<VirtualHost 1.2.3.4>
Sub Domain Stuff
</VirtualHost>


i.e. no Include /var/www/vhosts/{domain}.co.uk/subdomains/{subdomain}/conf/vhost.conf :-(
 
did you create the conf dir and put a vhost.conf in there (with content)? you could try creating a vhost_ssl.conf and run the reconfigure command and see if it wil create the include...
 
I did yes. The command you used was slightly different to what I was using..

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain> -r

I was using..

/usr/local/psa/admin/sbin/websrvmng -u --vhost-name=<domain>

But either way, it didn't work.

I'm not specifically trying to use SSL, but I'm willing to give it a go!.... OK, created a (empty) vhost_ssl.conf and reconfigured using the above command, but no luck..

I got my info from this website..

http://enarion.net/web/plesk/subdomains-and-open_basedir/

Arg. I don't know why this is so tricky to get working. Like yu I must have tried 100 different things and I'm still stuck :-(
 
try puting '##' in the vhost.conf or vhost_ssl.conf. Maybe it needs to have content? the -u or --reconfigure-vhost is the same... the -r makes apache restart so it will use the new configuration...

I remember I also disabled php and SSI on the subdomain from plesk interface and then reenable it but I don't think that made the include appear

fyi: my serverpath to the vhosts doesn't start with /srv/ww.... but with /var/ww......
 
Firstly, thanks for all your help. I really appreciate it!

Unfortunately, nothing appears to want to work. I even tried disabling the PHP support and addeding it again :)

I have an idea that maybe I can tag the contents of the subdomain vhosts.conf onto the end of the vhosts.conf file in the top-level domain. At least that way it will be read and added to the httpd.include file....

But I don't know what the knock-on effects are from doing this...
 
Can I just double check something..?

In the httpd.include file, do you have an "Include" directive in the section for the Top-level domain, PLUS an "Include" directive sub-domain ?

Mine looks like this..


...
Include /var/www/vhosts/{domain}.co.uk/conf/vhost.conf
</VirtualHost>

But there is no such Include for the subdomain, in my file at least.
 
Back
Top