Static files quick-start
Prerequisites:
- Basic terminal / command line skills
- A folder containing your website
There are two easy ways to get a quick file server up and running. We’ll show you two equivalent ways to do the same thing.
In your terminal, change to the root directory of your site and run:
If you get a permissions error, it probably means your OS does not allow you to bind to low ports — so use a high port instead:
caddy file-server --listen :2015
If you don’t have an index file but you want to display a file listing, use the --browse
option:
You can use another folder as the site root:
caddy file-server --root ~/mysite
Caddyfile
In the root of your site, create a file called with these contents:
If you don’t have permission to bind to low ports, replace localhost
with localhost:2015
(or some other high port).
You can then load (or whatever the address is in your config) to see your site!
The directive has more options for you to customize your site. Make sure to Caddy (or stop and start it again) when you change the Caddyfile!
If you don’t have an index file but you want to display a file listing, use the browse
argument:
You can also use another folder as the site root:
localhost