推荐轻量级的http服务器darkhttpd

https://unix4lyfe.org/darkhttpd/

特点:单进程命令行即可启动,无需配置。

darkhttpd/1.10, copyright (c) 2003-2014 Emil Mikulic.
usage:  ./darkhttpd /path/to/wwwroot [flags]

flags:  --port number (default: 8080, or 80 if running as root)
                Specifies which port to listen on for connections.
                Pass 0 to let the system choose any free port for you.

        --addr ip (default: all)
                If multiple interfaces are present, specifies
                which one to bind the listening port to.

        --maxconn number (default: system maximum)
                Specifies how many concurrent connections to accept.

        --log filename (default: stdout)
                Specifies which file to append the request log to.

        --chroot (default: don't chroot)
                Locks server into wwwroot directory for added security.

        --daemon (default: don't daemonize)
                Detach from the controlling terminal and run in the background.

        --index filename (default: index.html)
                Default file to serve when a directory is requested.

        --mimetypes filename (optional)
                Parses specified file for extension-MIME associations.

        --uid uid/uname, --gid gid/gname (default: don't privdrop)
                Drops privileges to given uid:gid after initialization.

        --pidfile filename (default: no pidfile)
                Write PID to the specified file.  Note that if you are
                using --chroot, then the pidfile must be relative to,
                and inside the wwwroot.

        --no-keepalive
                Disables HTTP Keep-Alive functionality.

        --forward host url (default: don't forward)
                Web forward (301 redirect).
                Requests to the host are redirected to the corresponding url.
                The option may be specified multiple times, in which case
                the host is matched in order of appearance.

        --no-server-id
                Don't identify the server type in headers
                or directory listings.

 

Leave a Reply

Your email address will not be published.