lighttpd2 and php under fast-cgi returns 403 "Permission denied"
1
vote
1
answer
714
views
lighttpd2 is under development but it's faar enough to where i want to start using it.
I've overcome the hurdle of installing it and getting vhost etc working.
* PHP 5.6.6 (cgi-fcgi) (built: Feb 20 2015 17:27:21)
* lighttpd-angel/2.0.0 - a fast and lightweight webserver
| Build date: Mar 17 2015 13:42:32
* Arch Linux | linux 3.18.6-1
* VMWare Workstation 11.1.0 build-2496824
However php gives me the worst headache.
/etc/lighttpd2/php.conf
looks as follows:
if phys.path =$ ".php" {
log.write "Accessing php file";
fastcgi "unix:/srv/http/php.sock";
}
The sock used to reside under /var/run/lighttpd2/ but for access/debugging purposes I moved it to /srv/http where the entire doc-root is.
And this is what my /etc/lighttpd2/lighttpd.conf
looks like:
setup {
module_load [
"mod_accesslog",
"mod_dirlist",
"mod_vhost"
"mod_fastcgi"
];
listen "0.0.0.0:80";
listen "[::]:80";
log [
"info" => "/var/log/lighttpd2/info.log",
"error" => "/var/log/lighttpd2/error.log",
"abort" => "/var/log/lighttpd2/error.log",
"backend" => "/var/log/lighttpd2/backend.log",
"debug" => "/var/log/lighttpd2/debug.log",
default => "/var/log/lighttpd2/error.log"
];
accesslog "/var/log/lighttpd2/access.log";
accesslog.format "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"";
static.exclude_extensions [ ".php", ".pl", ".fcgi", "~", ".inc" ];
}
include "/etc/lighttpd2/mimetypes.conf";
include "/etc/lighttpd2/vhost.conf";
include "/etc/lighttpd2/php.conf";
#docroot "/srv/http";
index [ "index.php", "index.html", "index.htm", "default.htm", "index.lighttpd.html" ];
dirlist;
static;
Not sure if I should comment out static
at the end or not.
And finally, my "startup script" for php looks as follows:
#!/bin/sh
exec 2>&1
PHP_FCGI_CHILDREN=2 \
PHP_FCGI_MAX_REQUESTS=10000 \
LANG=C LC_ALL=C \
exec /usr/bin/spawn-fcgi -n -s /srv/http/php.sock -u www-data -U www-data -- /usr/bin/php-cgi
My logs are almost empty, but never the less here's what they say:
Startup log from systemd
---
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_plugin.c:166): activate
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_plugin.c:177): done
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:765: Reached state: suspended (dest: down)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:677: Try reaching state: stopping (dest: down)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:765: Reached state: stopping (dest: down)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:677: Try reaching state: down (dest: down)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:765: Reached state: down (dest: down)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (info) lighttpd_worker.c:141: going down
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: debug (angel_server.c:367): instance released
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_main.c:94): going down
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_plugin.c:166): activate
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_plugin.c:171): activate: core
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: debug (angel_server.c:184): Instance (30976) spawned: /usr/lib/lighttpd-2.0.0/lighttpd2/lighttpd2-worker
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_plugin.c:177): done
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: info (angel_main.c:90): parsed config file
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) lighttpd_worker.c:105: config path: /etc/lighttpd2/lighttpd.conf
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) plugin_core.c:1254: loaded module 'mod_accesslog'
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) plugin_core.c:1254: loaded module 'mod_dirlist'
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) plugin_core.c:1254: loaded module 'mod_vhost'
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) plugin_core.c:1254: loaded module 'mod_fastcgi'
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:765: Reached state: loading (dest: suspended)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:677: Try reaching state: suspended (dest: suspended)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:765: Reached state: suspended (dest: suspended)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: debug (angel_plugin_core.c:638): listen to ipv4: '0.0.0.0:80' (port: 80)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: debug (angel_plugin_core.c:679): listen to ipv6: '::' (port: 80)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:677: Try reaching state: warmup (dest: running)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:765: Reached state: warmup (dest: running)
Mar 17 17:14:21 ArchKB lighttpd2: 2015-03-17 17:14:21 CET: lighttpd2-worker: 17/Mar/2015 17:14:21 CET (debug) server.c:677: Try reaching state: running (dest: running)
Error-log is empty, but info.log
says:
17/Mar/2015 17:14:21 CET (info) server.c:58: Got signal, shutdown
debug.log
says:
17/Mar/2015 17:12:29 CET (debug) server.c:677: Try reaching state: suspending (dest: down)
17/Mar/2015 17:12:29 CET (debug) server.c:765: Reached state: suspending (dest: down)
17/Mar/2015 17:12:29 CET (debug) server.c:677: Try reaching state: suspended (dest: down)
17/Mar/2015 17:12:29 CET (debug) server.c:765: Reached state: running (dest: running)
And access.log
(after I've requested index.php) says:
192.168.253.1 192.168.253.130 - [17/Mar/2015:17:12:36 +0100] "GET / HTTP/1.1" 403 3744 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36"
Access on files
---
If I comment out everything to do with **php**, I get the file as a downloaded object with the proper content of:
The header()
mod is just to make sure that lighttp doesn't screw up the headers because it's CGI (it's happned before and this *should* not affect the end result in a bad way).
The permissions looks as follows:
-rwxrwxrwx 1 www-data www-data 84 Mar 17 16:40 index.php
srw-r----- 1 www-data www-data 0 Mar 17 16:47 php.sock
-rw-r--r-- 1 root root 5 Mar 17 17:06 wham.html
"Funny" thing is that I can request wham.html
without a problem and it's owned by root, but according to the documentation only working should be run as non-root, which I am:
root 30975 0.0 0.6 5104 3140 ? Ss 17:14 0:00 /usr/sbin/lighttpd2 -c /etc/lighttpd2/angel.conf
www-data 30976 0.0 0.7 52048 3760 ? Ssl 17:14 0:00 /usr/lib/lighttpd-2.0.0/lighttpd2/lighttpd2-worker --angel -c /etc/lighttpd2/lighttpd.conf
Where the hell am I going wrong about this?
---
My conclusion is that it's something to do with php.conf
, because log.write
never executes, or at least I can't see anything in any of the logs.
So I need help, badly!
Asked by Torxed
(3727 rep)
Mar 17, 2015, 03:33 PM
Last activity: Mar 18, 2015, 08:25 AM
Last activity: Mar 18, 2015, 08:25 AM