I have a strange situation, I have installed lighttpd and php5-fpm through aptitude
I've created one vhost and the and the fpm pool.
This is the main.conf (global FPM)
[global]
pid = /var/run/php-fpm.pid
error_log = /home/lighttpd/log/php-fpm.log
log_level = error
emergency_restart_threshold = 5
emergency_restart_interval = 2
process_control_timeout = 2
daemonize = yes
include=/home/lighttpd/vhosts/*/conf/php-fpm.conf
This is the vhost's pool
[website.com]
listen = 127.0.0.1:9000
listen.backlog = -1
user = website.com
group = website.com
pm = dynamic
pm.max_requests = 0
pm.max_children = 2
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
request_terminate_timeout = 2
request_slowlog_timeout = 1
slowlog = /home/lighttpd/vhosts/website.com/log/php-slow.log
chroot = /home/lighttpd/vhosts/website.com/web
; Chdir to this directory at the start. This value must be an absolute path.
; Default Value: current directory or / when chroot
;chdir = /
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
My lighttpd configuration is:
## Moduli da caricare
server.modules = (
"mod_alias",
"mod_compress",
"mod_rewrite",
"mod_redirect",
"mod_accesslog"
)
## Document root
server.document-root = "/home/lighttpd/vhosts/"
## File temporanei.
server.upload-dirs = ("/home/lighttpd/tmp")
## LOG
server.errorlog = "/home/lighttpd/log/error.log"
accesslog.filename = "/home/lighttpd/log/access.log"
## File ricercati quando viene richiesta una directory
index-file.names = (
"index.php",
"index.html",
"index.htm",
"default.htm"
)
## Negare l'accesso al codice sorgente di questi file
static-file.exclude-extensions = (
".php",
".pl",
".fcgi",
".conf"
)
server.pid-file = "/var/run/lighttpd.pid"
dir-listing.encoding = "utf-8"
server.dir-listing = "disable"
server.username = "lighttpd"
server.groupname = "lighttpd"
## Compressione dei contenuti
compress.cache-dir = "/home/lighttpd/cache/"
compress.filetype = (
"text/plain",
"text/html",
"application/x-javascript",
"text/css"
)
## Mapping dei mimetype
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
#Virtual Hosts
include "/home/lighttpd/vhosts/vhosts.conf"
and the vhost is:
## WEBSITE.COM
$HTTP["host"] =~ "(^|.)website\.com$" {
server.document-root = "/home/lighttpd/vhosts/website.com/web"
server.errorlog = "/home/lighttpd/vhosts/website.com/log/error.log"
accesslog.filename = "/home/lighttpd/vhosts/website.com/log/access.log"
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"host" => "127.0.0.1",
"port" => "9000"
)
)
)
}
If I visit www.website.com/page.html it works good.
If I visit www.website.com/page.php I always get 404 error.
I really don't know how to fix it. I also check the process list, and all the processes started well:
lighttpd 974 0.0 0.0 88812 2136 ? S 02:13 0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
root 998 0.0 0.1 127268 4316 ? Ss 02:13 0:00 /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/main.conf
1004 999 0.0 0.1 127812 4628 ? S 02:13 0:00 /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/main.conf
also netstat -lnp confirm it:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 998/php5-fpm
Could someone help me? I dont' understand why PHP pages are not processed… I also checked the .log and I don't see errors.
Update
I tried chroot /home/lighttpd/vhosts/website.com/
and then chdir /web
(for the http docs) but nothing. I have php-fpm.conf (the pool) at /home/lighttpd/vhosts/website.com/conf/php-fpm.conf
.
Best Answer
Try getting rid of the
chroot
in the pool config, I think the webserver is passing the full file path to the FastCGI server and (of course) it won't be able to find the file.