Hi all,
I write in English to reach more people.
If you want to use Caddy2 on your QNAP but you do not know how to do it, here is a quick step-by-step guide:
STEP 0:
On the configuration panel of QTS, ensure that you are not using ports 80 and 443.
Go to System -> General Settings -> System Administration:
- System port should be different from 80 (e.g. 8080)
- If you want you can keep the HTTPS connection enabled (not really useful if you want to use a reverse proxy, though), but ensure the port is NOT 80 (e.g. 4443).
Go to System -> Network & File Services -> Win/Mac/NFS/WebDAV:
- if you want to use WebDAV, again ensure you are NOT using port 80 or 443.
STEP 1:
Install Caddy2 from the qnapclub.eu repository (this guide assumes you will use this package)
STEP 2:
- Log into the NAS with SSH and modify the following file: /share/CACHEDEV1_DATA/.qpkg/Caddy2/
- In particular, change the line where there are the execution instructions
I suggest to change it somehow like the below:
STEP 3:
Create the file indicated in the STEP 2 above: /share/homes/admin/caddy/Caddyfile and fill it with information similar to the ones below:
STEP 4
Using SSH use the following instruction to ensure the file is beautifully formatted (and easier to spot issues):
STEP 5
Validate the config file via SSH using the following instruction:
STEP 6
Run Caddy via SSH (so to spot additional issues, if any):
STEP 7
On your router, port forward all inbound connections to port 80 and 443 to your NAS (in the example 192.168.10.9).
STEP 8
Of course, be sure to have duly configured DNS of your domain!
Have fun!
I write in English to reach more people.

If you want to use Caddy2 on your QNAP but you do not know how to do it, here is a quick step-by-step guide:
STEP 0:
On the configuration panel of QTS, ensure that you are not using ports 80 and 443.
Go to System -> General Settings -> System Administration:
- System port should be different from 80 (e.g. 8080)
- If you want you can keep the HTTPS connection enabled (not really useful if you want to use a reverse proxy, though), but ensure the port is NOT 80 (e.g. 4443).
Go to System -> Network & File Services -> Win/Mac/NFS/WebDAV:
- if you want to use WebDAV, again ensure you are NOT using port 80 or 443.
STEP 1:
Install Caddy2 from the qnapclub.eu repository (this guide assumes you will use this package)
STEP 2:
- Log into the NAS with SSH and modify the following file: /share/CACHEDEV1_DATA/.qpkg/Caddy2/
- In particular, change the line where there are the execution instructions
I suggest to change it somehow like the below:
Code:
./caddy run --config /share/homes/admin/caddy/Caddyfile --watch --pidfile /var/run/caddy.pid &
STEP 3:
Create the file indicated in the STEP 2 above: /share/homes/admin/caddy/Caddyfile and fill it with information similar to the ones below:
Code:
{
log {
output file /share/homes/admin/caddy/Caddy2-logs/caddy2.log
}
email your@email.com
}
qnap.example.com {
log {
output file /share/homes/giopas/script/caddy/Caddy2-logs/qnap-example.log
}
encode gzip
header Strict-Transport-Security max-age1536000;
reverse_proxy http://192.168.10.9:8080
}
STEP 4
Using SSH use the following instruction to ensure the file is beautifully formatted (and easier to spot issues):
Code:
./caddy fmt --overwrite /share/homes/admin/caddy/Caddyfile
STEP 5
Validate the config file via SSH using the following instruction:
Code:
./caddy validate /share/homes/admin/caddy/Caddyfile
STEP 6
Run Caddy via SSH (so to spot additional issues, if any):
Code:
[/share/CACHEDEV1_DATA/.qpkg/Caddy2] # ./Caddy2.sh start
STEP 7
On your router, port forward all inbound connections to port 80 and 443 to your NAS (in the example 192.168.10.9).
STEP 8
Of course, be sure to have duly configured DNS of your domain!

Have fun!