← Previous → Next Contents

Nobska Light, Cape Cod, MA, 1998-06-17

Running the web server

xttpd is an XTide web server.  It provides web-based access to XTide's tide predictions by allowing a web browser to speak directly to the XTide program in HTTP.  xttpd can replace httpd or it can co-exist with one.

Once the port is established, xttpd will try to set its UID and GID to values that were specified at compile time.  If it is unable to do this, it will log failure messages to syslog and then exit.  Consequently, if it is to be started by someone other than root, that user's UID and GID must be configured at compile time.  Instructions for doing this are available at https://flaterco.com/xtide/installation.html#xttpd.

You can set the address for feedback either at compile time as described in the installation instructions or with the environment variable XTTPD_FEEDBACK.

xttpd will accept settings either from command line switches (as used with xtide or tide) or from an .xtide.xml file that is saved in the home directory of the account that is used to execute it.  Settings that are customized using the xtide control panel and then saved can be applied to xttpd by copying in the .xtide.xml file.

xttpd will produce a small number of zombie processes during normal operation.  They are cleaned up after each new connection, so there is no cause for concern.

Since a web site is supposed to be self-explanatory, the process of using xttpd will not be documented here.  If there are problems with people not being able to figure out how to use it, these should be reported to me as bugs, and the explanatory text in the web server will be updated accordingly.

Conventional operation

Usage:  xttpd [port] [...other xtide settings switches...].

xttpd forks itself into the background and uses the syslog facility for all logging.  Hosts connecting to xttpd are logged with priority INFO.

If you run xttpd with no command line arguments, it will assume that it is replacing httpd and try to bind port 80.  If you want it to co-exist with an existing server, or if you do not have privilege to get port 80, give it the port number as the first command line argument:

% xttpd 8080

You will then need to link it up as http://www.wherever.org:8080/ instead of just http://www.wherever.org/, but otherwise, no damage done.  Similarly, if you wish to bind a specific address, you can specify that as the first argument:

% xttpd 127.0.0.2

If you need to specify both address and port number, separate the two with a slash, like this:

% xttpd 127.0.0.2/8080

(New in XTide 2.15)  IPv6 addresses and hostnames are now accepted for the address.

Systemd operation (XTide 2.15)

If xttpd was built with --enable-systemd, it cannot be run from the command line or from init scripts.  The port, address, and command line options can only be changed by editing systemd config files as described in the installation section.

Command line switches for settings can be specified in xttpd.service on line ExecStart=.

Troubleshooting

Q: When I run xttpd, it exits immediately with no errors to tell me what went wrong.

A: When executed, xttpd immediately disassociates itself from your terminal and starts logging all diagnostics to syslog.  So look in your system logs.  On an init system, you will find these someplace like /var/log or /var/adm/log.  On a systemd system, you have to say (as root) journalctl -b -p debug --no-pager to dump the log.

If all else fails, xttpd can be built with the debugging option -DXTTPD_NO_DAEMON to make it stay attached to the terminal and print errors to stderr.  (Requires XTide 2.15)


← Previous → Next Contents