• 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

problem with vhost.conf and file uploads

C

cyberpunkdreams

Guest
Hi,

I've got a bit of a problem with the virtual hosts on my server, which I am almost certain was caused by me messing around with it without properly knowing what I was doing.

What happened was that I couldn't upload files via a web form (my own system, which does work fine on my development system) due to various restrictions and whatnot, and after some research I figured I ought to add these to the vhost.conf file for that virtual server (where example.com would be the URL of the site):

php_admin_value open_basedir /home/httpd/vhosts/example.com/httpdocs:/tmp
php_admin_value upload_tmp_dir /home/httpd/vhosts/example.com/httpdocs/tmp

Then I ran '/usr/local/psa/admin/sbin/websrvmng -a -v' to get it all working. I also did the same to each new virtual server I set up, thinking I was avoiding future problems.

However, what's happened is that if I now try to do an upload to one of these servers (say, trying to do an attachment with Horde web mail), it fails, as the system is trying to upload the file to a tmp directory that belongs to one of the other virtual hosts. I've tried various things to fix it, and the fixes work for a short while, before the problem re-occurs. The virtual host it chooses seems to be random.

I figure that I've done something very stupid and naive and (hopefully) easy to fix, but I can't figure out what!

Any solutions would be greatly appreciated.

Thanks very much
Rob
 
You should wrap them in <Directory> so they are treated for the specific domain only.


eg:

<Directory /home/httpd/vhosts/example.com/httpdocs>
php_admin_value open_basedir /home/httpd/vhosts/example.com/httpdocs:/tmp
php_admin_value upload_tmp_dir /home/httpd/vhosts/example.com/httpdocs/tmp
</Directory>

Give that a try
 
Thanks! I haven't tried it yet, but I think that's almost certain to solve my problem. I had just assumed that the vhost.conf file only applied to the directory it was in my default.

thanks again
Rob
 
Back
Top