命令行参数 - longcnn/websocketd_CN GitHub Wiki

最新版参看:https://github.com/joewalnes/websocketd/blob/master/help.go

示例:$ websocketd --port=8080 /usr/bin/php my-server.php

  --port=PORT                    指定监听的HTTP端口HTTP port to listen on.  
  --address=ADDRESS              地址梆定Address to bind to (multiple options allowed)  
                                 使用方括号来指定IPv6地址Use square brackets to specify IPv6 address.   
                                 默认为"" (所有all)  
  --sameorigin={true,false}      Restrict (HTTP 403) protocol upgrades if the  
                                 Origin header does not match to requested HTTP   
                                 Host. Default: false.  
  --origin=host[:port][,host[:port]...]
                                 Restrict (HTTP 403) protocol upgrades if the
                                 Origin header does not match to one of the host
                                 and port combinations listed. If the port is not
                                 specified, any port number will match. 
                                 Default: "" (allow any origin)

  --ssl                          指定监听用SSL加密的HTTPS socket代替HTTP.                     
  --sslcert=FILE                 指定证书文件,后缀一般是.pem文件
  --sslkey=FILE                  指定证书文件,此后缀为.key 此处三个ssl相关可选项要么一起被忽略,要么一起出现 

  --redirport=PORT               Open alternative port and redirect HTTP traffic
                                 from it to canonical address (mostly useful
                                 for HTTPS-only configurations to redirect HTTP
                                 traffic)
  --passenv VAR[,VAR...]         Lists environment variables allowed to be
                                 passed to executed scripts.
  --binary={true,false}          Switches communication to binary, process reads
                                 send to browser as blobs and all reads from the
                                 browser are immediately flushed to the process.
                                 Default: false
  --reverselookup={true,false}   Perform DNS reverse lookups on remote clients.
                                 Default: false
  --dir=DIR                      Allow all scripts in the local directory
                                 to be accessed as WebSockets. If using this,
                                 option, then the standard program and args
                                 options should not be specified.
  --staticdir=DIR                Serve static files in this directory over HTTP.
  --cgidir=DIR                   Serve CGI scripts in this directory over HTTP.
  --maxforks=N                   Limit number of processes that websocketd is 
                                 able to execute with WS and CGI handlers.
                                 When maxforks reached the server will be 
                                 rejecting requests that require executing 
                                 another process (unlimited when 0 or negative).
                                 Default: 0
  --closems=milliseconds         Specifies additional time process needs to gracefully
                                 finish before websocketd will send termination signals 
                                 to it. Default: 0 (signals sent after 100ms, 250ms, 
                                 and 500ms of waiting)
  --header="..."                 Set custom HTTP header to each answer. For
                                 example: --header="Server: someserver/0.0.1"
  --header-ws="...."             Same as --header, just applies to only those
                                 responses that indicate upgrade of TCP connection
                                 to a WebSockets protocol.
  --header-http="...."           Same as --header, just applies to only to plain
                                 HTTP responses that do not indicate WebSockets
                                 upgrade
  --help                         Print help and exit.
  --version                      Print version and exit.
  --license                      Print license and exit.
  --devconsole                   启用交互式开发控制台,这样你就可以看到更详细的执行细节了。
                                 This enables you to access the websocketd
                                 server with a web-browser and use a
                                 user interface to quickly test WebSocket
                                 endpoints. For example, to test an
                                 endpoint at ws://[host]/foo, you can
                                 visit http://[host]/foo in your browser.
                                 This flag cannot be used in conjunction
                                 with --staticdir or --cgidir.

  --loglevel=LEVEL               日志记录级别 (默认为access级).
                                 从左至右,从日志记录最详细细节到一般大概描述的级别如下:
                                 debug, trace, access, info, error, fatal

Full documentation at http://websocketd.com/