I’ve managed to run hugo on docker thanks to @razon on this other support post.
Now I’ve “managed” to run it behind nginx proxy manager, but I fail to understand how I generate the contents of the public folder using the nextcloud docker.
I run hugo like this:
docker run -p 1313:1313 \
-v ${PWD}:/src \
hugomods/hugo:latest \
hugo server --port=1313 -b="www.myweb.com" --appendPort=false --buildDrafts --buildFuture --bind 0.0.0.0
I run my nginx proxy manager with this compose file (extract):
version: '3'
services:
npm-app:
image: 'jc21/nginx-proxy-manager:latest'
restart: always
ports:
- '80:80'
- '81:81'
- '443:443'
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_DB_MYSQL_USER: myuser
DB_MYSQL_PASSWORD: "mypassword"
DB_MYSQL_NAME: "npm"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
- /home/user/dockers/web/mywebsite/public:/site
And in the nginx proxy manager GUI interface, for the subdomain, under the Custom Nginx Configuration
I put:
location / {
root /site/;
}
As shown here.
But, the problem is that running hugo as exposed, the ‘/public’ folder is still empty.
If I try to execute hugo
via docker exec -u 33 -it hugo-hugo-1 hugo
, I get permission erros:
Start building sites …
hugo v0.121.1-00b46fed8e47f7bb0a85d7cfc2d9f1356379b740+extended linux/amd64 BuildDate=2023-12-08T08:47:45Z
Total in 19 ms
Error: error building site: failed to acquire a build lock: open /src/.hugo_build.lock: permission denied
I tried with root, just to test:
docker exec -u root -it hugo-hugo-1 /bin/sh
And indeed I could execute hugo
command from within and the contents of /public
were generated and I could access to the site via https on my subdomain www.myweb.com.
But the files under /public
belong to the root user, which I don’t think is intented, right?
So how show I correctly do it?