Reputation: 21
I'm using Lighttpd and php-fpm, I would like to chroot the vhost of each website.
The pages of the website are in: /home/vhosts/example1.com/web
each vhost has the same layer:
/home/vhosts/example1.com/web
/home/vhosts/example2.com/web
/home/vhosts/example3.com/web
I used this kind of path as document-root of the domain (example1.com), I don't know what psychical path I should use to chroot the vhost, I tried:
document-root = /web
chroot = /home/vhosts/example1.com/ (on php-fpm.conf file)
but I always get 404 NOT FOUND error. How can I chroot the vhost?
(Each website has .php and .html pages.)
Upvotes: 0
Views: 4357
Reputation: 2447
Use the $prefix
& $pool
variables in fpm.conf to simplfy configuration for multiple chroots
[example1.com]
prefix = /home/vhosts/$pool/
listen = $prefix/php.sock
chroot = $prefix
[example2.com]
prefix = /home/vhosts/$pool/
listen = $prefix/php.sock
chroot = $prefix
You may want to use TCP / IP to listen insted of sockets for a fast growing site as it's more stable than using unix sockets
Don't forget to limit to limit TCP connections by IP address:
listen.allowed_clients = 127.0.0.1
Upvotes: 0
Reputation: 48284
In lighttpd.conf:
server.document-root = "/home/vhosts/example1.com/web"
fastcgi.server = (
".php" => (
"localhost" => (
"docroot" => "/web",
"socket" => "/home/vhosts/example1.com/php.socket",
)
)
)
In fpm.conf:
listen = /home/vhosts/example1.com/php.socket
chroot = /home/vhosts/example1.com/
Upvotes: 1