Merge pull request #1525 from joshrotenberg/guide/server-command-updates
Update serve documentation in the guide
This commit is contained in:
commit
331aad1597
|
@ -1,7 +1,13 @@
|
||||||
# The serve command
|
# The serve command
|
||||||
|
|
||||||
The serve command is used to preview a book by serving it over HTTP at
|
The serve command is used to preview a book by serving it via HTTP at
|
||||||
`localhost:3000` by default. Additionally it watches the book's directory for
|
`localhost:3000` by default:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mdbook serve
|
||||||
|
```
|
||||||
|
|
||||||
|
The `serve` command watches the book's `src` directory for
|
||||||
changes, rebuilding the book and refreshing clients for each change. A websocket
|
changes, rebuilding the book and refreshing clients for each change. A websocket
|
||||||
connection is used to trigger the client-side refresh.
|
connection is used to trigger the client-side refresh.
|
||||||
|
|
||||||
|
@ -17,24 +23,14 @@ root instead of the current working directory.
|
||||||
mdbook serve path/to/book
|
mdbook serve path/to/book
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Server options
|
### Server options
|
||||||
|
|
||||||
`serve` has four options: the HTTP port, the WebSocket port, the HTTP hostname
|
The `serve` hostname defaults to `localhost`, and the port defaults to `3000`. Either option can be specified on the command line:
|
||||||
to listen on, and the hostname for the browser to connect to for WebSockets.
|
|
||||||
|
|
||||||
For example: suppose you have an nginx server for SSL termination which has a
|
|
||||||
public address of 192.168.1.100 on port 80 and proxied that to 127.0.0.1 on port
|
|
||||||
8000\. To run use the nginx proxy do:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mdbook serve path/to/book -p 8000 -n 127.0.0.1 --websocket-hostname 192.168.1.100
|
mdbook serve path/to/book -p 8000 -n 127.0.0.1
|
||||||
```
|
```
|
||||||
|
|
||||||
If you were to want live reloading for this you would need to proxy the
|
|
||||||
websocket calls through nginx as well from `192.168.1.100:<WS_PORT>` to
|
|
||||||
`127.0.0.1:<WS_PORT>`. The `-w` flag allows for the websocket port to be
|
|
||||||
configured.
|
|
||||||
|
|
||||||
#### --open
|
#### --open
|
||||||
|
|
||||||
When you use the `--open` (`-o`) flag, mdbook will open the book in your
|
When you use the `--open` (`-o`) flag, mdbook will open the book in your
|
||||||
|
@ -55,5 +51,5 @@ contain file patterns described in the [gitignore
|
||||||
documentation](https://git-scm.com/docs/gitignore). This can be useful for
|
documentation](https://git-scm.com/docs/gitignore). This can be useful for
|
||||||
ignoring temporary files created by some editors.
|
ignoring temporary files created by some editors.
|
||||||
|
|
||||||
_Note: Only `.gitignore` from book root directory is used. Global
|
***Note:*** *Only the `.gitignore` from the book root directory is used. Global
|
||||||
`$HOME/.gitignore` or `.gitignore` files in parent directories are not used._
|
`$HOME/.gitignore` or `.gitignore` files in parent directories are not used.*
|
||||||
|
|
Loading…
Reference in New Issue