For reference, I did just this and forwarded a Hidden Service to my e-mail provider gateway.
This is running on an Ubuntu 16.04 server, but should work with really anything with nginx and tor on it.
Configuration is pretty easy, I've just got the defaults in the /etc/nginx/nginx.conf
file. Then in a new file /etc/nginx/sites-enabled/mail-reverse.conf
I've got:
server {
listen 8880;
location / {
proxy_pass https://webmail.emailsrvr.com/;
}
}
Finally, in /etc/tor/torrc
I've got this added:
HiddenServiceDir /var/lib/tor/mail
HiddenServicePort 80 127.0.0.1:8880
Now I can connect to the hostname in /var/lib/tor/mail/hostname
through Tor Browser and I get my webmail service - and as far as the provider sees, I only ever connect from my home IP address (which is where the hidden service is hosted).
Note that it's not perfect - in Tor Browser, I can see most of the requests got to the .onion site, but there are still a lot of other requests to the "normal" domains that make the site work (i.e. static resources like images and styles). I guess in this case, the page was able to work with just this simple config - I'm sure there would be more complex sites that might not work.