Skip to content

Server Mode

Chris Diana edited this page Nov 21, 2018 · 3 revisions

In Server mode, CMS.js takes advantage of the Server's Directory Indexing feature. By allowing indexes, CMS.js sends an AJAX call to your specified folders and looks for Markdown or HTML files. After they are found, it takes care of everything else and delivers a full website.

Apache, NGINX, Node HTTP-Server, Node Ecstatic and Python SimpleHTTPServer servers are supported using Server Mode.

Apache Server

For CMS.js to run, make sure to enable the directory indexing feature. You can do this two ways:

  • Option #1: Enable .htaccess - If you have .htaccess enabled, you're good to go!
  • Option #2: Apache config file - Add directory option to Apache configuration file /etc/httpd/httpd.conf or /etc/apache2/apache2.conf most likely:
<Directory /var/www/mysite.com/>
  Options Indexes
</Directory>

Make sure to restart Apache by either running /etc/init.d/httpd restart or /etc/init.d/apache2 restart.

NGINX Server

Verify that your nginx.conf has the autoindex on option:

server {
        listen 80;
        root "path to the directory of files";
        index index.html index.htm;
        server_name "name of the virtual host";

        location / {
                try_files $uri $uri/ /index.html;
                autoindex on;
                autoindex_exact_size off;
        }
}

Node HTTP-Server

Install

$ npm install -g http-server

Then, run in the directory where CMS.js is

$ http-server my-cms-js-blog/
Clone this wiki locally