The basic-http-server
is a simple HTTP server used to serve static content. In the context of the GridRustyKaspa project, it is used to serve the web wallet interface and other static files required for web-based interaction with the Kaspa node. This document provides a comprehensive guide on configuring, managing, and interacting with the basic-http-server
binary.
- Configuration
- Running Basic HTTP Server
- Interacting with Basic HTTP Server
- Logs and Monitoring
- Troubleshooting
- Appendix
The basic-http-server
binary can be configured using command-line arguments. Below is an example of how to configure it to serve files from the app/web
directory:
basic-http-server /path/to/app/web --addr 0.0.0.0:80 --log-level info
- Directory to Serve: The directory containing the files to be served (
/path/to/app/web
). - Address and Port: The address and port on which the server will listen (
0.0.0.0:80
). - Log Level: Sets the logging level (
info
,debug
,warn
,error
).
To start the basic-http-server
, use the following command:
basic-http-server /path/to/app/web --addr 0.0.0.0:80 --log-level info
Alternatively, if you are using Zinit for process management, you can start the server using the Zinit configuration file (basic-http-server.yaml
):
exec: /usr/local/bin/basic-http-server /path/to/app/web --addr 0.0.0.0:80 --log-level info
log: stdout
Start the service using Zinit:
zinit start basic-http-server
To stop the basic-http-server
, use the following command:
zinit stop basic-http-server
To restart the basic-http-server
, use the following command:
zinit restart basic-http-server
basic-http-server
provides a command-line interface for managing the server. Below are some useful commands:
-
Check version:
basic-http-server --version
-
Start in foreground:
basic-http-server /path/to/app/web --addr 0.0.0.0:80 --log-level info
-
Display help:
basic-http-server --help
Logs are essential for monitoring the status and activities of the basic-http-server
. By default, logs are output to stdout
. You can redirect logs to a file by configuring the log
option in the Zinit configuration file:
log:
path: "/var/log/basic-http-server.log"
level: "info"
To view the logs:
tail -f /var/log/basic-http-server.log
Here are some common issues and solutions for basic-http-server
:
- Server not starting: Check the command-line arguments for errors and ensure the directory to be served exists and is accessible.
- Connection issues: Verify network settings and ensure the server has access to the required ports.
- Permission errors: Ensure the user running the server has appropriate permissions to access the directory and bind to the specified port.
-
Check server status:
curl http://localhost:80
Refer to the basic-http-server
documentation for a detailed list of all configuration options and their descriptions.