2020-01-24 12:47:52 -07:00
---
title: Caddyfile Quick-start
---
# Caddyfile quick-start
Create a new text file named `Caddyfile` (no extension).
The first thing to type in a Caddyfile is your site's address:
```
localhost
```
Then hit enter and type what you want it to do, so it looks like this:
```
localhost
respond "Hello, world!"
```
Save this and run Caddy from the same folder that contains your Caddyfile:
< pre > < code class = "cmd bash" > caddy start< / code > < / pre >
2020-03-14 10:38:42 -06:00
< aside class = "tip" >
For local HTTPS, Caddy automatically generates certificates and unique private keys for you. The root certificate is added to your system's trust store, which is why the password prompt is necessary. It allows you to develop locally over HTTPS without certificate errors. Just don't share your root key!
< / aside >
2020-01-24 12:47:52 -07:00
2020-03-14 10:38:42 -06:00
You will probably be asked for your password, because Caddy will serve all sites -- even local ones -- over HTTPS. (The password prompt should only happen the first time!)
Either open your browser to [localhost ](http://localhost ) or `curl` it:
< pre > < code class = "cmd" > < span class = "bash" > curl https://localhost< / span >
2020-01-24 12:47:52 -07:00
Hello, world!< / code > < / pre >
You can define multiple sites in a Caddyfile by wrapping them in curly braces `{ }` . Change your Caddyfile to be:
```
localhost {
respond "Hello, world!"
}
localhost:2016 {
respond "Goodbye, world!"
}
```
You can give Caddy the updated configuration two ways, either with the API directly:
< pre > < code class = "cmd bash" > curl localhost:2019/load \
2020-03-14 10:38:42 -06:00
-X POST \
-H "Content-Type: text/caddyfile" \
--data-binary @Caddyfile
2020-01-24 12:47:52 -07:00
< / code > < / pre >
or with the reload command, which does the same API request for you:
< pre > < code class = "cmd bash" > caddy reload< / code > < / pre >
2020-03-14 10:38:42 -06:00
Try out your new "goodbye" endpoint [in your browser ](https://localhost:2016 ) or with `curl` to make sure it works:
2020-01-24 12:47:52 -07:00
2020-03-14 10:38:42 -06:00
< pre > < code class = "cmd" > < span class = "bash" > curl https://localhost:2016< / span >
2020-01-24 12:47:52 -07:00
Goodbye, world!< / code > < / pre >
When you are done with Caddy, make sure to stop it:
< pre > < code class = "cmd bash" > caddy stop< / code > < / pre >
## Further reading
- [Caddyfile concepts ](/docs/caddyfile/concepts )
- [Directives ](/docs/caddyfile/directives )