I am running pihole on nginx and want to access pihole over a reverse proxy. pihole.mydomain.com is forwarded to nginx on port 8090 (from my router) and from there reverse proxied to pi.hole/admin on port 80.
But I am facing 2 issues: When setting 'proxy_set_header Host $host;' in nginx, I cannot access the web interface because the hostname is invalid. And when I set 'proxy_pass http://pi.hole/admin/;' accessing the web interface is painfully slow, while using the local ip is fast as usual.
It might be advantageous to detail your post a bit and provide your nginx configuration. It is not quite clear e.g. whether you are serving Pi-hole from the same machine or still running lighttpd .
Note that lighttpd is Pi-hole's webserver. nginx isn't officially supported by Pi-hole, though we have an unsupported community guide to help setting up nginx as a replacement for lighttpd as a webserver.
Did you consider following that guide? If so, what is your motivation for abandoning it and runing nginx as a reverse proxy instead?
I am not familiar with nginx myself, so purely on a hunch:
You may want to cut out additional hostname resolutions, so refer to Pi-hole by IP, e.g. if Pi-hole is running on the same machine, use proxy_pass http://127.0.0.1/admin or your Pi-hole's IP address.
As this is an nginx rather than a Pi-hole issue, you may increase your chance for a knowledgeable answer by first and also consulting nginx documentation and forums.
To the same end, it might help changing your topic's title to contain nginx as a keyword, to better attract our users who might have relevant experience.