Frequently Asked Questions

The NearlyFreeSpeech.NET FAQ (*)

Customization (*)

What canonical name redirection settings are available?

How do I enable directory indexes for my site?

How do I create a website for the sole purpose of forwarding visitors to another website?

When should the rewrite log be used?

How do I change the text displayed for missing pages and other errors?

What should my site's canonical name be?

What path should I use for .htpasswd files?

What is a per-alias document root?

How do I restrict which IP addresses can access my site?

How do I control redirection of HTTP visitors to HTTPS?

Can I set up more than one alias for my site?

How do I make my site fast and scalable?

What is a run script?

If you configure a site type that supports arbitrary daemon processes, the infrastructure that initializes them does not process command line arguments. In the rare case that you don't need any, you can run the daemon executable directly from the 'Command' field of the Daemon management interface. In all other cases, you will need a run script.

A run script is a short shell script that lets you customize the environment for your daemon without worrying about the massive stack of stuff we have to do to make sure your daemon runs in the context of your site. A typical, minimal run script is an executable file that looks like this:

#!/bin/sh
exec /home/protected/bin/mydaemon.py --port=12345 --run-in-foreground

Then, you enter the path to the run script as the command in your daemon configuration. This lets you customize the daemon's command line arguments. You can also take other actions if needed, like setting environment variables, removing temporary files from previous runs, running preflight database checks, etc.

When writing run scripts, always make sure the following key elements are present:

  1. The shebang line is the first line of the run script. (#!/bin/sh)
  2. The exec command in front of the daemon executable. (Saves RAM = lower costs, may also avoid problems with signal delivery.)
  3. The daemon must run in the foreground. (Otherwise it will be repeatedly killed and restarted.)
  4. Starting the daemon is the last line in the run script. (Anything after that will almost never be run.)
  5. Executable permissions on the run script. (chmod a+x myrun.sh)

How do I change the server type my site uses?