nginx reverse proxy for M/Monit (not monit)

Barbecue Sauce saucebarbeque at
Sat Jun 24 19:39:28 UTC 2017

Hello all -

Apologies if this has been asked & answered already - I can't find a way to search the mailing list and I'm largely learning nginx the hard way.

I have an internet-facing nginx https server reverse proxying a number of internal apps on varying servers. In general, they run http internally.

To this point, I've been able to get 11 of the 12 working this way. The last one (M/Monit) is proving to be difficult...

My config is below. When I go to, it comes back with a weird URL, making me think my config is just wrong. That said, the config came from the team at M/Monit...

Does anyone have any ideas they could share?

Thanks in advance.

### config start:

add_header Cache-Control public;
server_tokens off;
server  {
  include /etc/nginx/proxy.conf;
  listen 443 ssl;
  keepalive_timeout 70;
  ssl on;
  ssl_certificate /etc/ssl/localcerts/autosigned.crt;
  ssl_certificate_key /etc/ssl/localcerts/autosigned.key;
  ssl_session_timeout 5m;
  ssl_protocols SSLv3 TLSv1.2;
  ssl_ciphers RC4:HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:10m;
  add_header X-Frame-Options DENY;
  root /var/www/html;
  index index.html;
  auth_basic "Access Restricted";
  auth_basic_user_file "/etc/nginx/.htpasswd";
  #limit_conn conn_limit_per_ip 20;
  #limit_req zone=req_limit_per_ip burst=20 nodelay;

  location /mmonit/ {
    #proxy_set_header Host $host;
    #proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header X-Forwarded-Host $host:$server_port;
    #proxy_set_header X-Forwarded-Server $host;
    #proxy_set_header X-Forwarded-Proto $scheme;
    #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    proxy_pass http://mmonit.server.local:2882;
    proxy_redirect http://mmonit.server.local:2882 /mmonit;
    rewrite ^/mmonit/(.*) /$1 break;
    proxy_cookie_path / /mmonit/;

  #  proxy_ignore_client_abort on;
  #  index index.csp
  #  auth_basic "Access Restricted";
  #  auth_basic_user_file "/etc/nginx/.htpasswd";
    access_log /var/log/nginx/mmonit.access.log;
    error_log /var/log/nginx/mmonit.error.log;

###Remainder of working config snipped

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list