PnyxCMS

A clean, lightweight PHP CMS. Open source and EUPL licensed.

Self-hosting PnyxCMS

PnyxCMS runs on any server with PHP 8.1+ and Apache 2.4 with mod_rewrite and AllowOverride All. No database is needed for flat-file content. Other web servers work if you translate the .htaccess rules yourself.

Install

cd /srv/www/example.eu
git clone https://codeberg.org/flavius/pnyxcms.git public_html
mkdir logs
chown www-data logs

Point your virtual host's DocumentRoot at public_html/. Only the logs directory needs to be writable by the web server.

Choose where things live

manifest.php defines where PnyxCMS keeps its configs, logs and content:

define("CONFIG_DIR", "./configs/");
define("LOG_DIR", "../logs/");
define("CONTENT_DIR", "./content/");

Relative and absolute paths both work, and the trailing slash is required. By default logs live one level above the web root, so they can never be served. If your host allows it, move the configs out of the web root too, for example to /etc/pnyxcms/example.eu/.

Configure

In configs/config.php, set at least url, domain, title, description, author and server-timezone. Two of these need care:

  • url must be the full address with a trailing slash, such as https://example.eu/. Every link the CMS generates is built from it.
  • domain is used to set cookies, for example for language switching or login. If it does not match your site's domain, those features will not work.

Components are enabled or disabled in manifest.php: add a component's name to its list to enable it, or remove the name to turn it off.

$enabled_libraries = array("dependency-resolver", "date", "text-processor");
$enabled_modules = array("main", "simple-pages", "posts");

Each component is configured in its own file in CONFIG_DIR, named after its type and name, such as module-simple-pages.php or library-text-processor.php.

Add content

Content is plain Markdown in CONTENT_DIR. A simple page such as module-simple-pages/about.md is served at /about.html, and its first # heading becomes its title.

Keep logs tidy

PnyxCMS writes one log file per type per day and never deletes them. To keep 14 days, add a daily cron job:

find /srv/www/example.eu/logs -name '*-????-??-??.log' -mtime +13 -delete

PHP-FPM

The root .htaccess uses php_value, which only works with mod_php. Under PHP-FPM it causes a 500 error on every page, so remove that line.

Update

PnyxCMS is a rolling build: BUILD in index.php is the build number, and components keep their own versions. To update, run git pull in the web root.

Questions and pull requests are welcome on Codeberg.