Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update how to modifying lighttpd configuration when you use caddy as web server #1012

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 41 additions & 9 deletions docs/guides/webserver/caddy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@ If you'd like to use [Caddy](https://caddyserver.com/) as your main web server w

## Modifying lighttpd configuration

First, change the listen port in this file: `/etc/lighttpd/lighttpd.conf:`
create your config file: `/etc/lighttpd/conf-available/04-caddy.conf` with the following content

```lighttpd
server.port = 1080
server.port := 1080
```

In this case, port 1080 was chosen at random. You can use a custom port.

BUT ANY CHANGES MADE TO THIS FILE WILL BE LOST ON THE NEXT PI-HOLE UPDATE.
link it to `/etc/lighttpd/conf-enabled` folder

So if you want a permanent method of changing the lighttpd port and your lighttpd version >= 1.4.46, you can overwrite the port in: `/etc/lighttpd/external.conf` (note the different syntax!):

```lighttpd
server.port := 1080
```bash
> ln -s /etc/lighttpd/conf-available/04-caddy.conf /etc/lighttpd/conf-enabled/04-caddy.conf
```

Next, restart the lighttpd server with either of these commands:
Expand All @@ -35,6 +31,42 @@ or
sudo service lighttpd restart
```

if your lighttpd is throwing the following error:

```
network.c.369) can't bind to socket: [::]:80: Permission denied
```

please check file `/etc/lighttpd/lighttpd.conf`

```lighttpd
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
```

is executed before the line:

```lighttpd
include "/etc/lighttpd/conf-enabled/*.conf"
```

Update `lighttpd.conf` from:

```lighttpd
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.conf.pl"
include "/etc/lighttpd/conf-enabled/*.conf"
```

to:

```lighttpd
include_shell "/usr/share/lighttpd/create-mime.conf.pl"
include "/etc/lighttpd/conf-enabled/*.conf"
# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
```

## Installing Caddy

Follow the instructions on the [Caddy download](https://caddyserver.com/docs/download) documentation page.
Expand Down
Loading