crystallix

A little web-server on Crystal which supports static files and CGI languages (tested with PHP)

Also, it gives you abilty to build pages using Crystal executables (See crweb section)

Installation

Usage

Just run

./crystallix

If you use release package and have any issues like missing shared libraries execute in Crystallix folder:

cc crystallix.o -o crystallix  -rdynamic -L/usr/bin/../lib/crystal/lib -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre -lm -lgc -lpthread /usr/share/crystal/src/ext/libcrystal.a -levent -lrt -ldl

Configs

Crystallix searches configuration files only in cfg folder

Currently there are 2 configs: config.json and sites.json

config.json (main config)

SSL configuration (https)

THAT SECTION MAY NOT WORK, didn't test it

There is ssl section in config to configurate SSL:

sites.json

Configuration for all sites stored in @:

"errors": {
    "redirect": true,
    "404": "%site_path%/errors/404.html",
    "403": "%site_path%/errors/403.html",
    "500": "%site_path%/errors/500.html"
}

If "redirect": true, Crystallix will redirect user to the path, otherwise it will just display file contents. Use redirect if you need include styles/scripts/etc.

For subdomains (tested)/many domains (not tested) specify individual list:
"@": {...},
"sub.domain.com": {
    "path": "pages/sub",
    "index": ["index.html"]
},
"...": {...}

crweb

From v0.1.1 you can use .crweb files, which should work like any CGI application

To create them easily, see https://github.com/De-Os/crystallix-pages