Hi, I’m begginer for hugo and personal server.
I’m trying to make hugo server run as background, so I want to quit session but not hugo server.
I’ve tried to use apache but gave up beacuse of ‘/’ permission.
So, I used screen on root and succeeded. But, if I try on user, shell says “Port 80 already in use”.
I checked port in use but no one is using port 80.
What should I do? Should I run hugo server on root?
Following is what I did through ssh. And OS is CentOS7.
[user@localhost mysite] hugo server --watch --baseURL=### --port=80 --appendPort=false --bind=0.0.0.0
Error: Port 80 already in use
If you’re trying to run the Hugo server for production, it’s not really for that. It’s for development, and you should use Hugo to generate the /public folder, then transfer that to whatever folder that will be hosted publicly, by Apache etc.
By the way, a good alternative to Apache and nginx these days is Caddy.
Search this forum for some more info on how people are using it. I have not had time to experiment with it yet, though.
If you mean just keeping the Hugo server running while you do other “stuff” in the terminal, the old *nix trick of adding an ampersand at the end of the command works –even though it doesn’t look like it has!:
hugo server --watch --renderToDisk &
Will still give you the
... Web Server is available at http://localhost:61802/ (bind address 127.0.0.1) Press Ctrl+C to stop
message in your terminal. But, if you start typing after that and hit RETURN, you’ll be back on the command line proper –and Hugo’s server will still be running in the background:
Without ampersand [typing ‘xxx’ and hitting RETURN after Hugo ‘server running’ message]:
With ampersand [typing ‘xxx’ and hitting RETURN after Hugo ‘server running’ message]:
Personally, I prefer just opening a new tab in my terminal. Saves me having to scroll back to find the Hugo server -pid, to kill it.
Good point @stiobhart.
You can also use
tmux, if you are on a *nix box with no tabs to use for that purpose. It’s trivial to open multiple sessions and windows, and switch between them, even if you’re not on a gui.
…which reminds me; I really must get around to installing
screen on my server. I have it on my RaspberryPi as that thing’s so slow, I often have to leave processes to do their thing in the background.
Another one for the never-ending ToDo list!
Rasberry Pi, huh @stiobhart ? Love to try one. Way way off topic I’m getting, I just got a little ARM-based microserver the size of a cigarette pack, from a company here in Tokyo “PlatHome”, called an OpenBlocks A7. It runs debian, and is a slick little thing that does its business in a ram disk. Very constrained in terms of disk space (unless you upgrade it), but, the performance for dhcp and bind dns is great for a small site. It’s set up with unityfs, so when you add a little SSD, you just give it the name they specify and voilà, instant expansion.
If you haven’t used
tmux, it’s an actively developed multiplexer, and has a few things that
screen doesn’t, but omits a couple too (it doesn’t connect to modems). It’s worth a look. @spf13 got me hooked on
vim and now I’m using
I solved with Caddy and screen. It seems very easy and fast.
Now time to deal with hugo!