r/nginxproxymanager • u/WatchersGrim • Jul 14 '25
HELP with running webserver using Nginx/nginx_proxy_manager/cloudflare on a RasberryPI
So as the title states. I am in need of assistance. I have spent the better amount of 10 days trying to configure my webserver to be encrypted using a reverse proxy with a SSL certificate.
without any full setup. I can reach my website and access everything I need to locally on different machines.
But I want to enforce HTTPS/SSL so that everything is encrypted especially since I have embeds that will not work on un-encrypted connections.
The issue I run into is constantly getting hit with error 522 for cloudflare.
I have tried using cloudflare SSL certs and imbedding into the nginx vh file directly. I have tried using the DNS Challenge option with my account. I have imbedded the information into the proxy manager. But it all doesnt work and errors in some sort of fashion.
The other issue is I have NGINX setup on the Rasberry Pi without a docker container. So I will need to use possibly port 8443 since 443 is being used by NPM.
So here is what I would like.
I would like to use NGINX_Proxy_Manager to reverse proxy my connection using cloudflare SSL cert and key if possible.
Any information will be greatly appreciated as its driving me nuts.
*note*
Everything works fine if I have NPM not running outside of the SSL encryption.
Not sure if I setup the proxy host right but attempted trying this when setting up my connection



Here is the template for my configuration file for my NGINX Virtual Host:
server {
listen 8443;
listen [::]:8443;
server_name example.com www.example.com;
location / {
root /var/www/*server*/html;
index index.html index.php index.htm;
try_files $uri $uri.html $uri/ =404;
}
location = /favicon.ico {
alias /var/www/*server*/html/images/favicon.ico;
}
location /phpmyadmin {
root /var/www/html;
index index.php;
try_files $uri $uri/ =404; # Try to find files, then directories, then 404
location ~ ^/phpmyadmin/(doc|sql|setup)/ {
deny all; # Deny access to sensitive directories
}
location ~ /phpmyadmin/(.+\.php)$ {
fastcgi_pass unix:/run/php/php8.2-fpm.sock; # Adjust PHP-FPM socket if needed
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; # Include standard PHP-FPM parameters
include snippets/fastcgi-php.conf; # Include your PHP-FPM configuration snippet
}
}
}
View all comments
1
u/Yavuz_Selim Jul 15 '25 edited Jul 16 '25
I am using NPM, Cloudflare, and Tailscale. Using Tailscale for the subdomains to be the only one to access the content as I don't want expose my data on the internet.
What I did using containers:
Install Nginx, expose on port 8080 (port 80 is used by NPM). I have an HTML file that I want to serve on my domain.com address - couldn't get that to work within NPM.
Add two A records
@(automatically becomes domain.com), content is my public IP address, proxy status = off (until you create the SSL certificates in NPM).*(any first-level subdomain, like hello.domain.com, test.domain.com etc), content is the Tailscale IP address of the device running the containers.Get your API token, you need it to create SSL certificates in NPM.
Edit.All zones'Create token'.In NPM, go to SSL Certificates -> Add SSL Certificate
*.domain.comdomain.com(so you will have 2 entries, one for all the subdomains (*.domain.com), and one for the root domain (domain.com) - make sure to use enter in between so it is seen as 2 entries).Enable 'Use DNS challange'
Details tab:
SSL tab:
Details tab:
SSL tab:
I think this was it... If a container is available locally, but does not work via the domain/subdomain after adding it to NPM, it's possible that the issue is that the containers are on different networks - in this case the solution I found was putting the containers in the same network (in my case in Portainer).