To set up a custom server process, follow these steps:
- Make sure your site's Server Type allows daemon processes.
- Create a Run Script that starts your custom process.
- On the Site Information panel for your site, in the Daemons box, choose the "Add a Daemon" button.On the Add Daemon panel, enter information about your daemon process:
- Tag: A unique (within your site's daemon processes) alphanumeric tag to identify this daemon.
- Command Line: The correct path to your run script.
- Working Directory: The current directory when the daemon is started. When using a run script, ignore this and include a cd command in your script instead. The correct working directory is dependent on the software you are running.
- Run Daemon As: Web servers should always be run as the "web" user and support servers should typically be run as the "me" user.
- The "Add Daemon" button will add the new daemon. The system will attempt to start it automatically within about a minute.
- Watch the Site Information panel to see if the daemon process starts and use its log file to debug any issues.
If (and only if) your custom process is a web server intended to handle incoming requests, you will also need to create a proxy:
- On the Site Information panel, in the Proxies box, use the "Add a Proxy" button.
- Enter the correct information required by your daemon process:
- Protocol: What protocol the system should use to communicate with your daemon process.
- Base Path: Which part of the site should be directed to the daemon process. Must begin and end with a forward slash.
- Document Root: What to replace the Base Path with when directing requests to your daemon process. Must begin and end with a forward slash. Some daemons need this to be based on the process's working directory (e.g., "/"). Others, including PHP-FPM, require an absolute path to the directory or routing script (e.g., "/home/protected/my-daemon/routing-script.php/").
- Target Port: The TCP port number (in the range 1024 to 65535) where your daemon process listens for requests. The correct port number depends entirely on your daemon process.
- Test and debug the proxy.
For additional information about this process and a complete example, please see the Django how-to on our blog.