Setting Up File Browser with Nginx Proxy Manager and Troubleshooting 502 Errors

Recently, I set up File Browser behind Nginx Proxy Manager on a Docker host. While the setup was straightforward, I ran into several common issues and learned how to resolve them.

1. File Browser Container Issues

After starting the container, logs showed repeated errors like:

chown: changing ownership of '/srv': Read-only file system
s6-applyuidgid: fatal: unable to set supplementary group list: Operation not permitted
  

This happens when File Browser runs as a non-root user but the volume permissions are not set correctly. To fix it:

  • Ensure the host directory is owned by the UID/GID expected by File Browser (default 33:33 for linuxserver images).
  • Mount the volumes with proper permissions, for example:
sudo chown -R 33:33 /path/to/config /path/to/srv
  

After correcting permissions, the container started successfully and initialized the database.

2. Configuring Nginx Proxy Manager

When adding File Browser as a proxy host:

  • Use the container's internal Docker IP or service name (filebrowser) as the forward hostname.
  • Use port 80 since File Browser listens on 80 inside the container.

Example configuration:

Domain Names: files.example.com
Scheme: http
Forward Hostname / IP: filebrowser
Forward Port: 80
Location: /
  

3. Troubleshooting 502 Bad Gateway

If you see 502 Bad Gateway:

  • Check that the File Browser container is running and listening on port 80.
  • Verify connectivity from the Nginx Proxy Manager container using the internal Docker network.
  • Ensure the volumes are not read-only and the container can write to /srv and /config.

4. SSH Tunnel Considerations

While testing remotely, I used an SSH tunnel:

ssh -L 8081:127.0.0.1:81 bijakit@your-server -p 20022
  

After closing the tunnel, the page still loaded due to browser caching. To fully disconnect:

  • Clear the browser cache and cookies for 127.0.0.1:8081.
  • Use Force Reload (Ctrl+F5 / Cmd+Shift+R) or open an incognito window.

5. Lessons Learned

  • Always set correct UID/GID for Docker volumes when using non-root containers.
  • 502 errors usually indicate connectivity issues or permission problems between Nginx and the backend service.
  • Browser caching can mislead you during SSH tunneling tests.

With these steps, I successfully set up File Browser behind Nginx Proxy Manager and resolved all 502 errors.


Support My Work

If this blog post helped you, please consider a small donation. Your support helps keep this content free and accessible for everyone. Thank you!

Donate with PayPal

The easiest way to support me is by buying me a coffee through PayPal. It's quick, secure, and uses a trusted platform.

Buy Me a Coffee! or a new Macbook!

Donate with Crypto

You can also support me with cryptocurrency. Just copy the address of your preferred coin below.

Bitcoin
31kpUFfNo8SSq5jidTY9Eihyb9qJS4FPP2
Ethereum
0x32fB1E082EB566bBbca3137a5a17a92db9C880F7
XRP
rsRy14FvipgqudiGmptJBhr1RtpsgfzKMM
XRP Tag
3802858062

Comments

Popular posts from this blog

Self-Hosted Personal Cloud: From Old Laptop to Fully Private Cloud

How to Download AnyFlip Books as PDFs with Anyflip Downloader

Mastering WordPress Multisite in cPanel: A Complete Guide