Server configuration

Here's how to set up different web servers.

Apache

The .htaccess configuration file for the Apache web server:

<IfModule mod_rewrite.c>
RewriteEngine on

DirectoryIndex index.html yellow.php
RewriteRule ^(cache|content|system)/ error [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ yellow.php [L]
</IfModule>

When your website doesn't work, please check the following steps. Add RewriteBase to the configuration file, this will fix most web server problems. Here's an example for a subfolder:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /yellow/
DirectoryIndex index.html yellow.php
RewriteRule ^(cache|content|system)/ error [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ yellow.php [L]
</IfModule>

Here's an example for a subdomain:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
DirectoryIndex index.html yellow.php
RewriteRule ^(cache|content|system)/ error [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ yellow.php [L]
</IfModule>

When your website still doesn't work, please check the Apache web server. If you use a selfhosted web server, you probably have to enable the rewrite module and configure AllowOverride All in the web server settings.

Make sure that the web server can read and write files. You can manually adjust file permissions so that the web server can overwrite files, for example with command chmod -R a+rw *. As an alternative you can assign the group www-data and umask 002 to the web server and users.

Nginx

The nginx.conf configuration file for the Nginx web server:

server {
    listen 80;
    server_name website.com;
    root /var/www/website/;
    index index.html yellow.php;

    location /cache {
        rewrite ^(.*)$ /error break;
    }

    location /content {
        rewrite ^(.*)$ /error break;
    }

    location /system {
        rewrite ^(.*)$ /error break;
    }

    location / {
        if (!-e $request_filename) {
            rewrite ^/(.*)$ /yellow.php last;
            break;
        }
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index yellow.php;
        include fastcgi_params;
    }
}

When your website doesn't work, please check server_name and root. If the configuration file has been changed, you need to restart/reload the Nginx web server.

Make sure that the web server can read and write files. You can manually adjust file permissions so that the web server can overwrite files, for example with command chmod -R a+rw *. As an alternative you can assign the group www-data and umask 002 to the web server and users.

Static website

Datenstrom Yellow is a flat-file CMS and a static site generator. To create a static website you run a build command from within the installation folder. It then generates a static website, that works on any web server.

You can create a static website from the command line:

  1. Open a terminal window.
  2. Go to your installation folder, where the yellow.php is.
  3. Type the following line: php yellow.php build /var/www/website

This will build a static website in folder /var/www/website. Upload the folder to your web hosting and build a new version when needed. The URL can be defined in the system settings, for example StaticUrl: http://website/.

As an alternative to a static website you can build a cache. This will speed up your website, but the cache has to be updated repeatedly. Here's an example: php yellow.php build. To clean the cache type the following line: php yellow.php clean.

Error page

When there are problems an error page is shown. When a web browser requests a file that the web server cannot find your website will show a “File not found” page. The file system/config/page-error-404.txt defines how a missing file looks like:

---
Title: File not found
---
The requested file was not found. Oh no...

If you use Datenstrom Yellow as a flat-file CMS there's nothing more to do. If you create a static website there's one additional step. Configure your web server to display your custom error page instead of its default 404 page.

For Apache add the following line to your configuration file:

ErrorDocument 404 /404.html

For Nginx add the following line to your configuration file:

error_page 404 /404.html;

Next: Security configuration →