# Setting up crowdsec (native on host) with nginx proxy manager (running in docker)

**URL:** <https://discourse.crowdsec.net/t/setting-up-crowdsec-native-on-host-with-nginx-proxy-manager-running-in-docker/2189>\
**Category:** crowdsec\
**Created:** [December 16, 2024, 10:00am UTC](https://discourse.crowdsec.net/t/setting-up-crowdsec-native-on-host-with-nginx-proxy-manager-running-in-docker/2189 "2024-12-16T10:00:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@matt](https://discourse.crowdsec.net/u/matt)\
**Post date:** [December 16, 2024, 10:00am UTC](https://discourse.crowdsec.net/t/setting-up-crowdsec-native-on-host-with-nginx-proxy-manager-running-in-docker/2189/1 "2024-12-16T10:00:16Z")

</div>

Yes i know i know, there are some tutorials and even youtube videos about this topic. Also a [tutorial](https://www.crowdsec.net/blog/crowdsec-with-nginx-proxy-manager) from the crowdsec team itself.  
BUT all those tutorials are about the [lepresidente/nginx-proxy-manager](https://hub.docker.com/r/lepresidente/nginx-proxy-manager) docker image. Sadly, one of the biggest issues is: the nginx web ui isn’t working anymore (which is also confirmed from several users). So i still wanrt to use the good old [NginxProxyManager/nginx-proxy-manager](https://github.com/NginxProxyManager/nginx-proxy-manager).

This is my nginx proxy manager docker compose file:

```auto
services:
app:
container_name: nginx_proxy_manager
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
networks:
- proxy_network
environment:
TZ: "Europe/Berlin"

networks:
proxy_network:

```

Which is working flawlessly. The web ui is reachable and about the last couple of month i can add hosts and managed those wiuth this reverse proxy. So far so good.

But now i want to secure the proxy with crowdsec. Is there a tutorial or a good documentation how to do this with [NginxProxyManager/nginx-proxy-manager](https://github.com/NginxProxyManager/nginx-proxy-manager) one INSTEAD the lepresidente image? All nginx log files are mounted from the nginx docker container on my host at `~/docker/nginxproxymanager/data/log/*.log` . Basically what i want: running npm in docker container. Running crowdsec native on my host (WITHOUT docker).

---

<div class="post-metadata">

**Author:** ![iiAmLoz](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/iiamloz/32/386_2.png) [@iiAmLoz](https://discourse.crowdsec.net/u/iiAmLoz)\
**Post date:** [December 16, 2024, 10:53am UTC](https://discourse.crowdsec.net/t/setting-up-crowdsec-native-on-host-with-nginx-proxy-manager-running-in-docker/2189/2 "2024-12-16T10:53:46Z")

</div>

So you can use the jc21 image with CrowdSec the only thing that is missing is the remediation which if you are _not_ using cloudflare this is fine as you can use the firewall remediation and block IP’s on the firewall level before it passed to docker and into NPM.

If you are using cloudflare with proxy enabled then your pretty stuck since on layer 4 all the firewall can see if cloudflare IP and not the IP that is being proxied in headers. So for that you either have to switch to other image such as npmPlus or lepresidente one.

---

<div class="post-metadata">

**Author:** ![LearningSpot](https://dub1.discourse-cdn.com/flex013/user_avatar/discourse.crowdsec.net/learningspot/32/1142_2.png) [@LearningSpot](https://discourse.crowdsec.net/u/LearningSpot)\
**Post date:** [February 17, 2025, 10:19am UTC](https://discourse.crowdsec.net/t/setting-up-crowdsec-native-on-host-with-nginx-proxy-manager-running-in-docker/2189/3 "2025-02-17T10:19:35Z")

</div>

I was wondering what’s the function of the Forward and Docker-user in iptable section in crowdsec-firewall-bouncer.yaml

```yaml
iptables_chains:
  - INPUT
# - FORWARD
# - DOCKER-USER

```

I haven’t dig deep yet but if not mistaken if we uncommented this then it can block IP for docker but if system reboot then crowdsec fails to run. Is there anyway to make it work?
