Skip to content

Commit 331aad1

Browse files
authored
Merge pull request #1525 from joshrotenberg/guide/server-command-updates
Update serve documentation in the guide
2 parents 7e01cf9 + c922b8a commit 331aad1

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

guide/src/cli/serve.md

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# The serve command
22

3-
The serve command is used to preview a book by serving it over HTTP at
4-
`localhost:3000` by default. Additionally it watches the book's directory for
3+
The serve command is used to preview a book by serving it via HTTP at
4+
`localhost:3000` by default:
5+
6+
```bash
7+
mdbook serve
8+
```
9+
10+
The `serve` command watches the book's `src` directory for
511
changes, rebuilding the book and refreshing clients for each change. A websocket
612
connection is used to trigger the client-side refresh.
713

@@ -17,24 +23,14 @@ root instead of the current working directory.
1723
mdbook serve path/to/book
1824
```
1925

20-
#### Server options
21-
22-
`serve` has four options: the HTTP port, the WebSocket port, the HTTP hostname
23-
to listen on, and the hostname for the browser to connect to for WebSockets.
26+
### Server options
2427

25-
For example: suppose you have an nginx server for SSL termination which has a
26-
public address of 192.168.1.100 on port 80 and proxied that to 127.0.0.1 on port
27-
8000\. To run use the nginx proxy do:
28+
The `serve` hostname defaults to `localhost`, and the port defaults to `3000`. Either option can be specified on the command line:
2829

2930
```bash
30-
mdbook serve path/to/book -p 8000 -n 127.0.0.1 --websocket-hostname 192.168.1.100
31+
mdbook serve path/to/book -p 8000 -n 127.0.0.1
3132
```
3233

33-
If you were to want live reloading for this you would need to proxy the
34-
websocket calls through nginx as well from `192.168.1.100:<WS_PORT>` to
35-
`127.0.0.1:<WS_PORT>`. The `-w` flag allows for the websocket port to be
36-
configured.
37-
3834
#### --open
3935

4036
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
5551
documentation](https://git-scm.com/docs/gitignore). This can be useful for
5652
ignoring temporary files created by some editors.
5753

58-
_Note: Only `.gitignore` from book root directory is used. Global
59-
`$HOME/.gitignore` or `.gitignore` files in parent directories are not used._
54+
***Note:*** *Only the `.gitignore` from the book root directory is used. Global
55+
`$HOME/.gitignore` or `.gitignore` files in parent directories are not used.*

0 commit comments

Comments
 (0)