[docuwiki et lighttpd] config qui ne fonctionne pas (résolu)

Questions et astuces concernant l'installation et la configuration d'archlinux
rasta
archer
Messages : 142
Inscription : mar. 21 févr. 2012, 02:16

[docuwiki et lighttpd] config qui ne fonctionne pas (résolu)

Message par rasta »

Bonjour,

Je tente d'installer un docuwiki en locale couplé avec lighttp, mais sa fonctionne pas du tout.

J'ai suivi le wiki de docuwiki https://wiki.archlinux.org/index.php/dokuwiki qui indique de configurer lighttpd pour PHP " Install your web server of choice (e.g. Apache, nginx or lighttpd) and configure it for PHP".

Donc direction le wiki de lighttpdhttps://wiki.archlinux.org/index.php/Lighttpd. J'installe le paquet lighttpd

Code : Tout sélectionner

# systemctl start lighttpd
$ firefox 127.0.0.1
Sa fonctionne nickel !

Puis je JUMP directement à la section PHP du wiki lighttpd pour mon docuwiki. Là on me dis d'installer php et php-cgi puis de créer et d'éditer le fichier /etc/lighttpd/conf.d/fastcgi.conf. Seulement le dossier /etc/lighttpd/conf.d n'existe pas, donc je le créé à la main:

Code : Tout sélectionner

# mkdir /etc/lighttpd/conf.d
# cd  /etc/lighttpd/conf.d/
# vim fastcgi.conf
On me dit de remplir le contenue de fastcgi.conf avec ceci:

Code : Tout sélectionner

# Make sure to install php and php-cgi. See:                                                             
# https://wiki.archlinux.org/index.php/Fastcgi_and_lighttpd#PHP

server.modules += ("mod_fastcgi")

# FCGI server
# ===========
#
# Configure a FastCGI server which handles PHP requests.
#
index-file.names += ("index.php")
fastcgi.server = ( 
    # Load-balance requests for this path...
    ".php" => (
        # ... among the following FastCGI servers. The string naming each
        # server is just a label used in the logs to identify the server.
        "localhost" => ( 
            "bin-path" => "/usr/bin/php-cgi",
            "socket" => "/tmp/php-fastcgi.sock",
            # breaks SCRIPT_FILENAME in a way that PHP can extract PATH_INFO
            # from it 
            "broken-scriptfilename" => "enable",
            # Launch (max-procs + (max-procs * PHP_FCGI_CHILDREN)) procs, where
            # max-procs are "watchers" and the rest are "workers". See:
            # https://redmine.lighttpd.net/projects/1/wiki/frequentlyaskedquestions#How-many-php-CGI-processes-will-lighttpd-spawn 
            "max-procs" => 4, # default value
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "1" # default value
            )
        )
    )   
)
Et puis là premier problème, il faut rajouter cette ligne dans /etc/lighttpd/lighttpd.conf:

Code : Tout sélectionner

include "conf.d/fastcgi.conf"
Et là je fais un:

Code : Tout sélectionner

# systemctl restart lighttpd
$ firefox 127.0.0.1
Et plus rien dans mon navigateur. Et je vois dans les log:

Code : Tout sélectionner

# tail -f /var/log/lighttpd/error.log
Jan 15 00:42:26 solid systemd[1]: Stopping Lighttpd Web Server...
Jan 15 00:42:27 solid lighttpd-angel[10103]: lighttpd-angel.c.139: child (pid=10104) exited normally with exitcode: 0
Jan 15 00:42:28 solid systemd[1]: Stopped Lighttpd Web Server.
Jan 15 00:42:28 solid systemd[1]: Started Lighttpd Web Server.
Jan 15 00:42:28 solid lighttpd-angel[10251]: Duplicate config variable in conditional 0 global: index file.names
Jan 15 00:42:28 solid lighttpd-angel[10251]: 2016-01-15 00:42:28: (configfile.c.974) source: /etc/lighttpd/lighttpd.conf line: 18 pos: 16 parser failed somehow near here: (EOL)
Jan 15 00:42:28 solid lighttpd-angel[10251]: lighttpd-angel.c.139: child (pid=10252) exited normally with exitcode: 255
et dans /var/log/lighttpd/error.log:

Code : Tout sélectionner

# tail -f  /var/log/lighttpd/error.log 
2016-01-15 00:42:26: (server.c.1456) [note] graceful shutdown started 
2016-01-15 00:42:26: (server.c.1572) server stopped by UID = 0 PID = 1010
Donc problème de parsing, j'en suis là. Et quand j'enlève la ligne include "conf.d/fastcgi.conf", tout fonctionne.

Puis je trouve cette doc sur le redmine de lighttpd https://redmine.lighttpd.net/projects/1 ... ModFastCGI qui dit:

Code : Tout sélectionner

Module: mod_fastcgi

Note
This means you need to include the line
server.modules += ( "mod_fastcgi" )
or
include "conf.d/fastcgi.conf"

(which should have the line server.modules += ( "mod_fastcgi" ) by default)
in your lighttpd.conf file. Without this, you'll get the error
WARNING: unknown config-key: fastcgi.server (ignored)
when trying to use lighttpd with fastcgi and, for example, php.
Donc je me dis pas grâve et je continue en enlevant cette ligne et la remplaçant par

Code : Tout sélectionner

server.modules += ( "mod_fastcgi" )
Et puis je redémarre le service qui se lance parfaitement. Donc je continue le wiki docuwiki. Je configure /etc/php/php.ini

Code : Tout sélectionner

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/
et

Code : Tout sélectionner

extension=gd.so
Et je JUMP sur la section lighttpd où on me dit de rajouter sa dans lighttp.conf:

Code : Tout sélectionner

server.modules += ("mod_access")
server.modules += ("mod_alias")
Puis sa:

Code : Tout sélectionner

 subdir of dokuwiki
# comprised of the subdir of the root dir where dokuwiki is installed
# in this case the root dir is the basedir plus /htdocs/
# Note: be careful with trailing slashes when uniting strings.
# all content on this example server is served from htdocs/ up.
#var.dokudir = var.basedir + "/dokuwiki"
var.dokudir = server.document-root + "/dokuwiki"

# make sure those are always served through fastcgi and never as static files
# deny access completly to these
$HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/(bin|data|inc|conf)/"  { url.access-deny = ( "" ) }

alias.url += ("/dokuwiki" => "/usr/share/webapps/dokuwiki/")
Et puis je redémarrage le service lighttpd.conf et là sa fonctionne mais aucunne trace de docuwiki à l'horizon, juste la page par défaut de lighttpd.

puis je trouve ce liens sur le wiki qui dit regardé à ce liens si sa marche pas https://www.dokuwiki.org/install:lighttpd. Qui propose de faire un lien symbolique et d'utiliser la commande

Code : Tout sélectionner

# lighttpd-enable-mod dokuwiki
# ll /etc/lighttpd/conf-available/50-dokuwiki.conf 
lrwxrwxrwx 1 root root 27 Feb  5 21:09 /etc/lighttpd/conf-available/50-dokuwiki.conf -> /etc/dokuwiki/lighttpd.conf  
Commande INEXISTANTE sur mon archlinux.

Voici mon fichier de config /etc/lighttpd/lighttpd.conf:

Code : Tout sélectionner

#include "conf.d/fastcgi.conf"
server.modules += ( "mod_fastcgi" )
server.modules += ("mod_access")
server.modules += ("mod_alias")

server.bind             = "127.0.0.1"
server.port             = 80
server.username         = "http"
server.groupname        = "http"
server.document-root    = "/srv/http/"
server.errorlog         = "/var/log/lighttpd/error.log"
dir-listing.activate    = "enable"
index-file.names        = ( "index.html" )
mimetype.assign         = (
                                ".html" => "text/html",
                                ".txt" => "text/plain",
                                ".css" => "text/css",
                                ".js" => "application/x-javascript",
                                ".jpg" => "image/jpeg",
                                ".jpeg" => "image/jpeg",
                                ".gif" => "image/gif",
                                ".png" => "image/png",
                                "" => "application/octet-stream"
                        )

var.dokudir = server.document-root + "/dokuwiki"

$HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/(bin|data|inc|conf)/"  { url.access-deny = ( "" ) }

alias.url += ("/dokuwiki" => "/usr/share/webapps/dokuwiki/")
Bon si quelqu'un peut m'aider c'est cool, mais pour la config de docuwiki+lighttpd c'est pas light comme casse tête. Désolé pour la longeur du post, mais au moins vous avez toute les clés sur ma situation pour m'aider correctement.


Update:

En plçant la ligne include "conf.d/fastcgi.conf" à la fin du fichier lighttpd.conf, je n'ai plus d'erreur de parsing mais toujours pas de docuwiki.

Par contre j'ai une nouvelle erreur dans les logs:

Code : Tout sélectionner


[code]
Jan 15 01:12:54 solid systemd[1]: Stopping Lighttpd Web Server...
Jan 15 01:12:54 solid lighttpd-angel[10417]: lighttpd-angel.c.139: child (pid=10419) exited normally with exitcode: 0
Jan 15 01:12:54 solid systemd[1]: Stopped Lighttpd Web Server.
Jan 15 01:12:54 solid systemd[1]: Started Lighttpd Web Server.
Jan 15 01:12:54 solid lighttpd-angel[10470]: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/gd.so' - /usr/lib/php/modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
Jan 15 01:12:54 solid lighttpd-angel[10470]: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/gd.so' - /usr/lib/php/modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
Jan 15 01:12:54 solid lighttpd-angel[10470]: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/gd.so' - /usr/lib/php/modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
Jan 15 01:12:54 solid lighttpd-angel[10470]: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/gd.so' - /usr/lib/php/modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
UPDATE 2:

Je n'ai plus de message d'erreur dans les logs si j'installe php-gd:

Code : Tout sélectionner

#  pacman -S php-gd
C'était sa je crois!

Bonne nuit à tous.
Répondre