2021-09-11 15:10:32 +00:00
# Proxy
2019-11-13 18:50:54 +00:00
## Apache
2022-08-12 07:34:49 +00:00
2019-11-13 18:50:54 +00:00
This guide provides a brief overview for installing Woodpecker server behind the Apache2 webserver. This is an example configuration:
2019-07-05 13:30:25 +00:00
```nohighlight
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
```
You must have the below Apache modules installed.
```nohighlight
a2enmod proxy
a2enmod proxy_http
```
You must configure Apache to set `X-Forwarded-Proto` when using https.
```diff
ProxyPreserveHost On
+RequestHeader set X-Forwarded-Proto "https"
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
```
2019-11-13 18:50:54 +00:00
## Nginx
2019-07-05 13:30:25 +00:00
2019-11-13 18:50:54 +00:00
This guide provides a basic overview for installing Woodpecker server behind the nginx webserver. For more advanced configuration options please consult the official nginx [documentation ](https://www.nginx.com/resources/admin-guide/ ).
2019-07-05 13:30:25 +00:00
Example configuration:
```nginx
server {
listen 80;
2019-11-13 18:50:54 +00:00
server_name woodpecker.example.com;
2019-07-05 13:30:25 +00:00
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_buffering off;
chunked_transfer_encoding off;
}
}
```
You must configure the proxy to set `X-Forwarded` proxy headers:
```diff
server {
listen 80;
2019-11-13 18:50:54 +00:00
server_name woodpecker.example.com;
2019-07-05 13:30:25 +00:00
location / {
+ proxy_set_header X-Forwarded-For $remote_addr;
+ proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_buffering off;
chunked_transfer_encoding off;
}
}
```
2019-11-13 18:50:54 +00:00
## Caddy
2019-07-05 13:30:25 +00:00
2019-11-13 18:50:54 +00:00
This guide provides a brief overview for installing Woodpecker server behind the [Caddy webserver ](https://caddyserver.com/ ). This is an example caddyfile proxy configuration:
2019-07-05 13:30:25 +00:00
```nohighlight
2021-12-08 12:03:17 +00:00
woodpecker.example.com {
reverse_proxy woodpecker-server:8000
2019-07-05 13:30:25 +00:00
}
2022-08-12 07:34:49 +00:00
woodpeckeragent.example.com {
reverse_proxy h2c://woodpecker-server:9000
}
2019-07-05 13:30:25 +00:00
```
2022-08-12 07:34:49 +00:00
:::note
Above configuration shows how to create reverse-proxies for web and agent communication. If your agent uses SSL do not forget to enable [WOODPECKER_GRPC_SECURE ](/docs/administration/agent-config#woodpecker_grpc_secure ).
:::
2019-11-13 18:50:54 +00:00
## Ngrok
2022-08-12 07:34:49 +00:00
2019-07-05 13:30:25 +00:00
After installing [ngrok ](https://ngrok.com/ ), open a new console and run:
2022-08-12 07:34:49 +00:00
```bash
2021-12-08 12:03:17 +00:00
ngrok http 8000
2019-07-05 13:30:25 +00:00
```
2021-09-11 15:10:32 +00:00
Set `WOODPECKER_HOST` (for example in `docker-compose.yml` ) to the ngrok url (usually xxx.ngrok.io) and start the server.