Webmin behind reverse proxy

From FIA Wiki
Jump to: navigation, search

Essentially you have to have to be very specific with your config due to webmin always wanting to redirect you and nginx having a difficult time trying to rewrite and redirect all of it

To help the next person, make sure you've told webmin its going to be in another directory in /etc/webmin/config

NOTE: Slashes are very important in the rest of this answer. Removing then causes the pain and suffering in the original question

webprefix=/admin/quackwall-webmin webprefixnoredir=1 Next, you need to configure nginx. This is the hard part, but I've tried to explain what each part does

  1. Proxy for webmin
  2. Last slash is important

location /admin/quackwall-webmin/ {

   # Tell nginx that we want to proxy everything here to the local webmin server
   # Last slash is important
   # Change the response Location: header to come from our proxy directory, not the server
   # Fixes initial redirect after login
   proxy_redirect http://$host:10000/ /admin/quackwall-webmin/;
   # Also fixes initial redirect after login
   proxy_set_header        Host            $host;

} Restart both nginx and webmin, then they both should work.