hugo_server.md (5356B)
1 --- 2 title: "hugo server" 3 slug: hugo_server 4 url: /commands/hugo_server/ 5 --- 6 ## hugo server 7 8 A high performance webserver 9 10 ### Synopsis 11 12 Hugo provides its own webserver which builds and serves the site. 13 While hugo server is high performance, it is a webserver with limited options. 14 Many run it in production, but the standard behavior is for people to use it 15 in development and use a more full featured server such as Nginx or Caddy. 16 17 'hugo server' will avoid writing the rendered and served content to disk, 18 preferring to store it in memory. 19 20 By default hugo will also watch your files for any changes you make and 21 automatically rebuild the site. It will then live reload any open browser pages 22 and push the latest content to them. As most Hugo sites are built in a fraction 23 of a second, you will be able to save and see your changes nearly instantly. 24 25 ``` 26 hugo server [flags] 27 ``` 28 29 ### Options 30 31 ``` 32 --appendPort append port to baseURL (default true) 33 -b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/ 34 --bind string interface to which the server will bind (default "127.0.0.1") 35 -D, --buildDrafts include content marked as draft 36 -E, --buildExpired include expired content 37 -F, --buildFuture include content with publishdate in the future 38 --cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ 39 --cleanDestinationDir remove files from destination not found in static directories 40 -c, --contentDir string filesystem path to content directory 41 -d, --destination string filesystem path to write files to 42 --disableBrowserError do not show build errors in the browser 43 --disableFastRender enables full re-renders on changes 44 --disableKinds strings disable different kind of pages (home, RSS etc.) 45 --disableLiveReload watch without enabling live browser reload on rebuild 46 --enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages 47 --forceSyncStatic copy all files when static is changed. 48 --gc enable to run some cleanup tasks (remove unused cache files) after the build 49 -h, --help help for server 50 --ignoreCache ignores the cache directory 51 -l, --layoutDir string filesystem path to layout directory 52 --liveReloadPort int port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1) 53 --meminterval string interval to poll memory usage (requires --memstats), valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". (default "100ms") 54 --memstats string log memory usage to this file 55 --minify minify any supported output format (HTML, XML etc.) 56 --navigateToChanged navigate to changed content file on live browser reload 57 --noBuildLock don't create .hugo_build.lock file 58 --noChmod don't sync permission mode of files 59 --noHTTPCache prevent HTTP caching 60 --noTimes don't sync modification time of files 61 --panicOnWarning panic on first WARNING log 62 --poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes 63 -p, --port int port on which the server will listen (default 1313) 64 --printI18nWarnings print missing translations 65 --printMemoryUsage print memory usage to screen at intervals 66 --printPathWarnings print warnings on duplicate target paths etc. 67 --printUnusedTemplates print warnings on unused templates. 68 --renderStaticToDisk serve static files from disk and dynamic files from memory 69 --renderToDisk serve all files from disk (default is from memory) 70 --templateMetrics display metrics about template executions 71 --templateMetricsHints calculate some improvement hints when combined with --templateMetrics 72 -t, --theme strings themes to use (located in /themes/THEMENAME/) 73 --trace file write trace to file (not useful in general) 74 -w, --watch watch filesystem for changes and recreate as needed (default true) 75 ``` 76 77 ### Options inherited from parent commands 78 79 ``` 80 --clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00 81 --config string config file (default is path/config.yaml|json|toml) 82 --configDir string config dir (default "config") 83 --debug debug output 84 -e, --environment string build environment 85 --ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern 86 --log enable Logging 87 --logFile string log File path (if set, logging enabled automatically) 88 --quiet build in quiet mode 89 -s, --source string filesystem path to read files relative from 90 --themesDir string filesystem path to themes directory 91 -v, --verbose verbose output 92 --verboseLog verbose logging 93 ``` 94 95 ### SEE ALSO 96 97 * [hugo](/commands/hugo/) - hugo builds your site 98