Welcome! Log In Create A New Profile

Advanced

set open_basedir per virtual host (nginx + php + virtual host)

Posted by cruelsymbol 
set open_basedir per virtual host (nginx + php + virtual host)
June 10, 2009 11:16PM
Is there anyway I can set different "open_basedir" for php for each virtual host configured using nginx. Similarly is there any way i can set different php "session.save_path" for each virtual host.
Re: set open_basedir per virtual host (nginx + php + virtual host)
June 11, 2009 04:07AM
I haven't tried doing it but yes, it shouldn't be too hard. The solution would depend on what method you are using to serve php.

If you are going to use fastcgi, then using php-fpm and having a small, separate pool of worker(s) listening on a different socket for each virtual host should work (some people use 9000+UID of the owner of the virtual host). There is a section in php-fpm.conf for "Additional php.ini defines, specific to this pool of workers.".

If you are going to proxy to Apache then I assume you would put them in a .htaccess or in your httpd.conf file.

--
Jim Ohlstein
Re: set open_basedir per virtual host (nginx + php + virtual host)
June 11, 2009 05:31AM
Thanks

I'll see if i can try that out using spawn-fcgi. I wish i could use php-fpm but seems to be too silent since php-5.2.9 n cos of that our policies does not allow us to use that on a production server.
Re: set open_basedir per virtual host (nginx + php + virtual host)
June 15, 2009 06:31AM
it works pretty nicely
- spawning different fcgi for each vhost,
- each fcgi process set runs as a different user
- each vhost has its own php.ini file (which means its own open_base)
- decent access control per vhost.
- per vhost spawn-fcgi script (/etc/rc.d - FREEBSD) ... this needs some more testing though.

the only downside is too many php-cgi processes. but running as different uses has its benefits. It shows which vhosts are actually hogging the php-cgi process.

I think i'll document the whole process soon.

Thanks alot
Re: set open_basedir per virtual host (nginx + php + virtual host)
July 20, 2009 04:39AM
Hello.

cruelsymbol, can you post or link the configuration files you used for that? Or where do you documented?

Anyone else can explain more detailed for nginx-novice users?

Thanks a lot!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready