• 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

overriding open_basedir across subdomains -- vhost.conf doesn't work

C

calzone

Guest
so I've tried everything I've seen written on this board so far.

I created my vhost.conf file inside the subdomain, in it, I added:

Code:
<Directory /var/www/vhosts/domain.com >
        php_admin_flag engine on
        php_admin_value open_basedir none
</Directory>

I already ran /usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com

And I looked inside [COLOR= firebrick]/var/www/vhosts/domain.com/conf/httpd.include[/color] and confirmed that it is in fact including vhost.conf

I have since restarted apache and rebooted the server, but no dice. I'm still bound by the open_basedir declared by plesk in [COLOR= firebrick]/var/www/vhosts/domain.com/conf/httpd.include[/color]

This seems especially silly since subdomains really should be able to share scripts with eachother.

What gives?
 
Use:

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_flag engine on
php_admin_value open_basedir none
</Directory>
 
Ok, I will try that, thank you... it seems very sensible...

But, just to make things a little bit more complicated, I don't really want to turn off open_basedir, I want to set it to the root of the vhost.

However, to help me troubleshoot, I was trying to see if I could even just simply turn it off.

So, the question will be... if this does work, do I need to turn it off, and then turn it back on based on the new dir where I want it to take effect?

thank you for your help :)
 
Ok, I am realizing this seems to be more of an apache config issue than something related to plesk.

However, I'm hoping you can explain the logic above, because while it worked for my subdomain, it has not worked for my main domain.

** EDIT **

Ok, I got it working for my subdomain, and the portion below, which I posted earlier, is WRONG. It turns out I had a different include path error in my document and was attributing it to open_basedir.

HOWEVER, I still want to understand the logic used for choosing that particular directory path. I additionally tried to define it without enclosing it in a directory path, but that didn't work :confused:

** /EDIT **
I added the same bit to /var/www/vhosts/domain.com/conf/vhost.conf and I confirmed it was being included in /var/www/vhosts/domain.com/conf/httpd.include. But when a file in my primary domain tries to include a file from the subdomain, it fails.

So I then tried adding

Code:
<Directory /var/www/vhosts/domain.com/subdomains/subdomain1/httpdocs >
        AllowOverride All
        php_admin_flag engine on
        php_admin_value open_basedir none
</Directory>

I'm not sure why I added that, but I figured it couldn't hurt, since it was setting the value of open_basedir for the target directory.

And that's where my confusion lies: why do I even have to define this under <Directory ...> instead of simply putting one line in each of my vhost.conf that says: php_admin_value open_basedir none? Why doesn't that work?

:) thank you
 
httpd.include
# ATTENTION!
# DO NOT MODIFY THIS FILE OR ANY PART OF IT. THIS CAN RESULT IN IMPROPER PLESK
# FUNCTIONING OR FAILURE, CAUSE DAMAGE AND LOSS OF DATA. IF YOU REQUIRE CUSTOM
# MODIFICATIONS TO BE APPLIED TO THE CONFIGURATION, PLEASE, PERFORM THEM IN THE
# FOLLOWING FILE(S):
# /var/www/vhosts/mysite.com/conf/vhost.conf
# /var/www/vhosts/mysite.com/conf/vhost_ssl.conf
# /var/www/vhosts/mysite.com/subdomains/<subdomain-name>/conf/vhost.conf

However, editing or adding those files to the directory would not turn off open base directory. so I had to edit the httpd.include file directly.

Find php_admin_value open_basedir "/var/www/vhosts/mydomain.com/httpdocs:/tmp"
replace with
#php_admin_value open_basedir "/var/www/vhosts/mydomain.com/httpdocs:/tmp"

does anyone else know how other ways to turn off open base other than editing the file they tell us not too.....I believe this is a Plesk issue because it says so in httpd.include
 
Back
Top