mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-22 20:12:17 +00:00
fixed server reporting Web Server is available at https://localhost:1313 when server always serve http
This commit is contained in:
parent
73ec09258b
commit
2b412d4ac7
1 changed files with 4 additions and 2 deletions
|
@ -110,8 +110,6 @@ func server(cmd *cobra.Command, args []string) {
|
|||
|
||||
func serve(port int) {
|
||||
jww.FEEDBACK.Println("Serving pages from " + helpers.AbsPathify(viper.GetString("PublishDir")))
|
||||
jww.FEEDBACK.Printf("Web Server is available at %s\n", viper.GetString("BaseUrl"))
|
||||
fmt.Println("Press ctrl+c to stop")
|
||||
|
||||
httpFs := &afero.HttpFs{SourceFs: hugofs.DestinationFS}
|
||||
fileserver := http.FileServer(httpFs.Dir(helpers.AbsPathify(viper.GetString("PublishDir"))))
|
||||
|
@ -126,6 +124,10 @@ func serve(port int) {
|
|||
http.Handle(u.Path+"/", http.StripPrefix(u.Path+"/", fileserver))
|
||||
}
|
||||
|
||||
u.Scheme = "http"
|
||||
jww.FEEDBACK.Printf("Web Server is available at %s\n", u.String())
|
||||
fmt.Println("Press ctrl+c to stop")
|
||||
|
||||
err = http.ListenAndServe(":"+strconv.Itoa(port), nil)
|
||||
if err != nil {
|
||||
jww.ERROR.Printf("Error: %s\n", err.Error())
|
||||
|
|
Loading…
Reference in a new issue