The Fool

Création d'un nouveau blog

Cette recette donne la procédure pour créer un nouveau blog sur la plateforme DotClear 2 installée sur le serveur.

DNS

  • Redirection du nom de domaine/d'hôte vers The Fool

Sur le serveur

  • Créer le dossier /var/www/<user>/<domain>

  • Créer les répertoires /var/www/<user>/<domain>/public et /var/www/<user>/<domain>/themes

  • Copier le thème par défaut:

    $ cp -r /var/www/thefool/admin.filyb.info/themes/default/ /var/www/<user>/<domain>/themes/
    
  • Autoriser Nginx à lire et écrire dedans:

    # chown -R thefool:www-data /var/www/<user>/<domain>
    # chmod -R g+rw /var/www/<user>/<domain>
    
  • Créer /var/www/<user>/<domain>/index.php:

    <?php
    # ***** BEGIN LICENSE BLOCK *****
    # This file is part of DotClear.
    # Copyright (c) 2005 Olivier Meunier and contributors. All rights
    # reserved.
    #
    # DotClear is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    #
    # DotClear is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with DotClear; if not, write to the Free Software
    # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    #
    # ***** END LICENSE BLOCK *****
    
    if (isset($_SERVER['DC_BLOG_ID'])) {
            define('DC_BLOG_ID',$_SERVER['DC_BLOG_ID']);
    } if (isset($_SERVER['REDIRECT_DC_BLOG_ID'])) {
            define('DC_BLOG_ID',$_SERVER['REDIRECT_DC_BLOG_ID']);
    }else {
            # Define your blog here !
            define('DC_BLOG_ID','<monblog_id>');
    }
    
    require '/var/www/thefool/admin.filyb.info/inc/public/prepend.php';
    ?>
    
  • Ajouter le domaine dans /root/domain-list, et mettre à jour le certificat SSL

  • Configurer Nginx dans /etc/nginx/sites-available/<domain>:

    server {
            server_name  <domain>;
            include snippets/https-redirect;
    }
    
    server {
            server_name  <domain>;
            include snippets/https-base;
    
            root    /var/www/<user>/<domain>;
    
            try_files $uri $uri/ @dc;
            location @dc {
                rewrite ^/(.*)$ /index.php?$1 last;
            }
            rewrite ^/$ /index.php;
    
            location ~ \.php$ {
                fastcgi_pass    unix:/var/www/thefool/run/php7.0-fpm.sock;
                fastcgi_index   index.php;
                include         fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME  /var/www/<user>/<domain>/$fastcgi_script_name;
            }
    
            # deny access to .htaccess files, if Apache's document root
            # concurs with nginx's one
    
            location ~ /\.ht {
                deny  all;
            }
    }
    
  • Activer le site:

    # ln -s /etc/nginx/sites-available/<domain> /etc/nginx/sites-enabled
    # service nginx reload
    
  • Dans l'interface d'admin de DotClear2 :

    • Créer un nouveau blog, le configurer en QUERY_STRING
    • Se placer dans ce blog
    • Dans about:config, modifier :
      • public_path : /var/www/<user>/<domain>/public
      • public_url : https://<domain>/public
      • themes_path : /var/www/<user>/<domain>/themes
      • themes_url : https://<domain>/themes
  • Ajouter le site à <http://thefool.filyb.info/>