[Fixed, below is another error] I don't understand why I can't activate the cgi on my lighttpd server. Here I leave my /etc/lighttpd/lighttpd.conf
so you can see if I have something wrong.
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_cgi",
# "mod_rewrite",
)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
$HTTP["url"] =~ "/cgi-bin/" {
cgi.assign = ( ".py" = "/usr/bin/python" )
}
index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
fastcgi.server = ( ".php" => ((
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/tmp/php.socket"
)))
When I put the necessary code for the cgi to work, the server stops working. If I put service lighttpd restart
I get:Job for lighttpd.service failed. See 'systemctl status lighttpd.service' and 'journalctl -xn' for details.
If I put systemctl status lighttpd.service
the following:
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
Active: failed (Result: exit-code) since mar 2017-05-02 19:39:58 CEST; 50s ago
Process: 1495 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
may 02 19:39:58 raspberrypi lighttpd[1495]: 2017-05-02 19:39:58: (configfile.c.589) source: /etc/lighttpd/lighttpd.conf line: 20 pos: 27 use => for assignments in arrays
may 02 19:39:58 raspberrypi lighttpd[1495]: 2017-05-02 19:39:58: (configfile.c.954) configfile parser failed at: .py
may 02 19:39:58 raspberrypi systemd[1]: lighttpd.service: control process exited, code=exited status=255
may 02 19:39:58 raspberrypi systemd[1]: Failed to start Lighttpd Daemon.
may 02 19:39:58 raspberrypi systemd[1]: Unit lighttpd.service entered failed state.
If I put journalctl -xn
it, this comes out:
-- Logs begin at mar 2017-05-02 19:34:53 CEST, end at mar 2017-05-02 19:42:03 CEST. --
may 02 19:41:56 raspberrypi sudo[1543]: pam_unix(sudo:session): session opened for user root by (uid=0)
may 02 19:41:56 raspberrypi systemd[1]: Starting Lighttpd Daemon...
-- Subject: Unit lighttpd.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit lighttpd.service has begun starting up.
may 02 19:41:56 raspberrypi lighttpd[1551]: 2017-05-02 19:41:56: (configfile.c.589) source: /etc/lighttpd/lighttpd.conf line: 20 pos: 27 use => for assignments in arrays
may 02 19:41:56 raspberrypi lighttpd[1551]: 2017-05-02 19:41:56: (configfile.c.954) configfile parser failed at: .py
may 02 19:41:56 raspberrypi systemd[1]: lighttpd.service: control process exited, code=exited status=255
may 02 19:41:56 raspberrypi systemd[1]: Failed to start Lighttpd Daemon.
-- Subject: Unit lighttpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit lighttpd.service has failed.
--
-- The result is failed.
may 02 19:41:56 raspberrypi systemd[1]: Unit lighttpd.service entered failed state.
may 02 19:41:56 raspberrypi sudo[1543]: pam_unix(sudo:session): session closed for user root
may 02 19:42:03 raspberrypi sudo[1558]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -xn
may 02 19:42:03 raspberrypi sudo[1558]: pam_unix(sudo:session): session opened for user root by (uid=0)
EDIT : Now I get another error. If I put systemctl status lighttpd.service
the following:
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled)
Active: failed (Result: exit-code) since mar 2017-05-02 20:24:36 CEST; 3min 59s ago
Process: 1404 ExecStartPre=/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
If I put journalctl -xn
it, this comes out:
-- Logs begin at mar 2017-05-02 20:21:29 CEST, end at mar 2017-05-02 20:33:56 CEST. --
may 02 20:30:02 raspberrypi dhcpd[671]: DHCPDISCOVER from e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:30:03 raspberrypi dhcpd[671]: DHCPOFFER on 192.168.2.7 to e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:31:07 raspberrypi dhcpd[671]: DHCPDISCOVER from e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:31:08 raspberrypi dhcpd[671]: DHCPOFFER on 192.168.2.7 to e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:32:10 raspberrypi dhcpd[671]: DHCPDISCOVER from e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:32:11 raspberrypi dhcpd[671]: DHCPOFFER on 192.168.2.7 to e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:33:15 raspberrypi dhcpd[671]: DHCPDISCOVER from e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:33:16 raspberrypi dhcpd[671]: DHCPOFFER on 192.168.2.7 to e8:4e:06:4b:a9:d9 (raspberrypi) via wlan0
may 02 20:33:56 raspberrypi sudo[1445]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -xn
may 02 20:33:56 raspberrypi sudo[1445]: pam_unix(sudo:session): session opened for user root by (uid=0)
I think the error is pretty clear:
According to the file you have put corresponds to:
Therefore, the correct syntax should be using
=>
: