crystallix

Version, currently 0.1.14 versions

github.com/De-Os/crystallix

No description declared in shard.yml.

1 stars
0 dependents
License: not declared

Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  crystallix:
    github: De-Os/crystallix
    version: ~> 0.1.1

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.1. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

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

  • Download release package (https://github.com/De-Os/crystallix/releases) and extract into empty 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
  • Or build it yourself:
    1. git clone https://github.com/De-Os/crystallix
    2. cd crystallix
    3. crystal build --release --progress src/crystallix.cr

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)

  • port - main port (default - 80)
  • address - address which Crystallix will use (default - 0.0.0.0)
  • addons - CGI extensions path (default - {"crweb": true, "php": "/usr/bin/php-cgi"}), use it like "extension, without dot": "executable path (if crweb, just use true)"
SSL configuration (https)

THAT SECTION MAY NOT WORK, didn't test it

There is ssl section in config to configurate SSL:

  • use? - enable/disable SSL (default - false),
  • port - SSL port (default - 443)
  • chain - path to chain file (default - cfg/ssl/chain.crt)
  • key - path to key file (default - cfg/ssl/private.crt)

sites.json

Configuration for all sites stored in @:

  • path - path to the site folder (default - pages/tests/), required
  • index - array with indexes to try if file directory specified in url (default - ["index.php", "index.html"]), required
  • errors - list with custom pages for status code (default - {"404": "%site_path%/errors/404.html"}, %site_path% tells Crystallix to use site path), optional:
"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