Installation and Setup of Pico CMS
Pico is installed via Composer or by downloading a ready archive. Requirements are minimal: PHP 7.0+ (recommended 8.0+), extensions mbstring and dom. Database is not needed.
Installation via Composer
composer create-project picocms/pico-composer /var/www/mysite
cd /var/www/mysite
Installation from Archive
curl -L https://github.com/picocms/Pico/releases/latest/download/pico-release-v3.0.0.zip -o pico.zip
unzip pico.zip -d /var/www/mysite
Nginx Configuration
server {
listen 80;
server_name mysite.com;
root /var/www/mysite;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Close service directories
location ~ ^/(config|content|lib|vendor|\.git) {
deny all;
return 404;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Apache (.htaccess)
Pico comes with ready .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
# Protect content directories
<FilesMatch "\.(md|yml|yaml|twig)$">
Order allow,deny
Deny from all
</FilesMatch>
Configuration config/config.yml
site_title: My Site
base_url: ~ # auto-detect; set explicitly if issues
theme: my-theme
twig_config:
autoescape: false
cache: false # enable in production: 'cache/twig'
debug: false
content_dir: content/
content_ext: .md
date_format: 'd.m.Y'
timezone: 'Europe/Minsk'
locale: ru_RU.UTF-8
rewrite_url: true # Pretty URLs via mod_rewrite/Nginx
# Default meta
meta:
- name: description
- name: author
- name: date
- name: robots
- name: template
# Page order
pages_order:
by: alpha
asc: true
# Plugins
PicoFeed:
enabled: true
PicoSitemapPlugin:
enabled: true
Installing Plugins
Plugins are located in plugins/. Manual installation:
# Sitemap generation plugin
cd /var/www/mysite/plugins
git clone https://github.com/picocms/pico-plugin-sitemap.git PicoSitemap
# Or via composer if plugin is published
composer require picocms/pico-plugin-sitemap
Pico automatically connects all plugins from plugins/ that have {PluginName}.php file.
Content Directory Structure
content/
index.md # homepage
404.md # error page
_navigation.md # _ at start = hidden (not in nav)
about.md
services/
index.md
web-dev.md
mobile.md
blog/
index.md
%year%/
my-post.md # /blog/2024/my-post
Pages are sorted by filename; for manual sorting add numeric prefix: 01.about.md, 02.services.md.
Twig Cache in Production
# config/config.yml
twig_config:
cache: 'cache/twig'
# Clear cache when updating content/templates
rm -rf /var/www/mysite/cache/twig/*







