The location of server files

Standard Directories

Preliminaries

This note provides documentation on the files and directories used by the server.

A standard setup of the server software creates directories in several places. On Linux devices, there are distinct locations for configuration files, source code files, and public documents. These locations adhere to long-established conventions, and should be followed in most circumstances.

Server software

  • Source code: The server's source code files are placed in /usr/lib/node_modules/rwserve. These are the ECMAScript files that are interpreted by the Node.js executable. The process user should be granted read-only permission to these files.
  • Configuration: Configuration files written by the webmaster are placed in /etc/rwserve. These contain the settings that are the subject of the other notes in this series. The process user should be granted read-only permission to these files.
  • System: The Service Manager unit file (rwserve.service) is placed in /usr/lib/systemd/system. This contains the settings needed to start and stop the server process using the systemctl command. The root user should be granted read-write permission to this file.
  • Node.js: The Node.js executable is accessed through the file /usr/bin/node. Documentation on how to install Node.js can be found on the Internet.

Website resources

  • Static resources: The documents, scripts, style sheets, and media files that make up a website are placed in a sub-directory under /srv. By convention, the name of that sub-directory is the DNS name of the website plus the configured document-root subdirectory, so the static files for the DNS name example.com would be placed in /srv/example.com/document-root.
  • Encoding cache: Cached copies of compressed files, that are created by the server, are kept in the encoding-cache, so in concert with the above example those files would be written to /srv/example.com/encoding-cache.
  • Dynamic cache: Cached copies of compiled blue-phrase documents and linkmaps, that are created by the server, are kept in the dynamic-cache, so those files would be written to /srv/example.com/dynamic-cache.
  • Custom errors: The HTML files used as templates for custom error messages are placed in the location specified in the custom-errors section of the configuration file, which by convention would be /srv/example.com/custom-errors.
  • Plugin modules: JavaScript plugins written by third-parties are normally placed in the /srv/plugins directory, which is the designated spot for plugins that are shared by multiple virtual hosts. Plugins that software developers write for a single virtual host may be placed under its DNS-named sub-directory: following the above example, those plugins would be placed in /srv/example.com/plugins. Remember, whichever path chosen for plugins must match the location specified in the router section of the configuration file.

The permission levels for these files are described in the note File Permissions.

The location of server files