Table des matières

Installer nikola

Nikola est un moteur de site Web statique. Il permet en particulier d’écrire des billets de blog.

Jail

J'ai choisi de l'installer dans une jail, même si cela ne semble pas très utile puisque ce site utilise les environnements python.

Soit donc une jail appelée nikolas.

Une fois configurée installez les ports suivants:

root@popeye:# pkg -j nikolas install devel/py-pip devel/git devel/py-virtualenv graphics/py-pillow devel/py-pip  textproc/libxslt net/py-pyzmq

Entrez ensuite à l'interieur:

root@popeye:# jexec nikolas

Installation

Créer votre environnement python:

root@nikolas:# python3.7 -m venv nikola
root@nikolas:# sh
root@nikolas:# . bin/activate

Je passe sous sh puisque le script ne se source pas sous csh, un grand classique.

Finissez l'installation :

(nikola)#  bin/python -m pip install -U pip setuptools wheel
(nikola)#  bin/python -m pip install -U "Nikola[extras]"

Site

Créez votre premier site, ici placé dans bernique:

(nikola)# nikola init --demo bernique  
Creating Nikola Site                                                                                      
====================                                                                                      
                                                                                                                                                                                                                    
This is Nikola v8.0.4.  We will now ask you a few easy questions about your new site.                                                                                                                               
If you do not want to answer and want to go with the defaults instead, simply restart with the `-q` parameter.                                                                                                      
--- Questions about the site ---                                                                                                                                                                                    
Site title [My Nikola Site]: Punk sur le toit                                                                                                                                                                       
Site author [Nikola Tesla]: TurtleCrazy                                                                                                                                                                             
Site author's e-mail [n.tesla@example.com]: david@lapinbilly.eu                                                                                                                                                     
Site description [This is a demo site for Nikola.]: De tout, de rien, mais surtout de BSD                                                                                                                           
Site URL [https://example.com/]: http://nikolas.lapinbilly.eu                                                                                                                                                       
    The URL does not end in '/' -- adding it.                                                                                                                                                                       
Enable pretty URLs (/page/ instead of /page.html) that don't need web server configuration? [Y/n] n                                                                                                                 
--- Questions about languages and locales ---                                                                                                                                                                       
We will now ask you to provide the list of languages you want to use.                                                                                                                                               
Please list all the desired languages, comma-separated, using ISO 639-1 codes.  The first language will be used as the default.                                                                                     
Type '?' (a question mark, sans quotes) to list available languages.       
  Language(s) to use [en]: fr
Please choose the correct time zone for your blog. Nikola uses the tz database.                                                                                                                                     
You can find your time zone here:                                                                                                                                                                                   
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones                                                                                                                                                        
                                                                                                                                                                                                                    
Time zone [UTC]: Europe/Paris                                                                             
    Current time in Europe/Paris: 13:40:39                                                                
Use this time zone? [Y/n] y                                                                               
--- Questions about comments ---                                                                                                                                                                                    
You can configure comments now.  Type '?' (a question mark, sans quotes) to list available comment systems.  If you do not want any comments, just leave the field blank.                                           
Comment system:                                                                                                                                                                                                     
                                                                                                                                                                                                                    
That's it, Nikola is now configured.  Make sure to edit conf.py to your liking.                                                                                                                                     
If you are looking for themes and addons, check out https://themes.getnikola.com/ and https://plugins.getnikola.com/.                                                                                               
Have fun!                                                                                                                                                                                                           
[2020-04-22T11:40:44Z] INFO: init: A new site with example data has been created at bernique.                                                                                                                       
[2020-04-22T11:40:44Z] INFO: init: See README.txt in that folder for more information.

Suivez la documentation pour créer vos articles.

nginx

C'est un site statique, la configuration est assez simple. Une fois deployé, votre site se trouve sous /jails/nikolas/nikola/<site>/output.

nginx.conf
server {
                listen 80 ; 
                listen [::]:80 ;
                server_name  nikola.lapinbilly.eu ;
 
                location / {
                        root /jails/nikolas/nikola/bernique/output;
                        index  index.html index.htm;
                }
 
 
                # redirect server error pages to the static page /50x.html
                #
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                        root   /usr/local/www/nginx-dist;
                }
          }