Caddy Web Server with Automatic HTTPS
Caddy is an open-source web server for automatically managing HTTPS certificates, acts as a versatile reverse proxy, static file server, and load balancer. You can download it's executable from the official page.
Without any installation, caddy.exe can be placed somewhere safe, set to Path using
Environment Variables and go to the required server root directory, then run following command
using command prompt.
caddy file-server --domain localhost
Now you can access your HTTPS localhost from your browser using following url.
https://localhost
Directory browsing can be enabled using --browse flag. This will let you see the files listing if there
no index.html available inside it.
caddy file-server --domain localhost --browse
To start server with a specific port, use the --listen flag as follows.
caddy file-server --domain localhost --listen :3000
Reverse proxy feature is useful when you need to work with server-side scripting languages such as PHP. First, start your PHP server with a different port.
php -S localhost:8000
While keeping the PHP server running, start the Caddy server with reverse-proxy in another
terminal. and specify desired domain for --from flag and source domain for --to flag.
caddy reverse-proxy --from localhost --to localhost:8000
Then you can access your output server through https://localhost
To make the server accessible through your local area network (LAN) to other devices, find the local IP address and
use it instead of localhost
caddy file-server --domain 192.168.1.10
This works not only for file-server feature, also for reverse-proxy
caddy reverse-proxy --from 192.168.1.10 --to localhost:8000