Search code examples
nginxmonit

nginx and monit web interface - how to have monit on domain.com/monit versus domain.com


I am using monit on my ec2 instance and I am new to nginx. Below is my nginx config file:

server {
  listen 80;
  server_name 127.0.0.1;
  location / {
    proxy_pass 127.0.0.1:2812;
    proxy_set_header Host $host;
  }
}

So..if I go to domain.com I see monit. How do I modify above code where I can see monit on domain.com/monit?

Thanks


Solution

  • Please, try this:

    server {
      listen 80;
      server_name 127.0.0.1;
    
      location /monit/ {
        proxy_pass http://127.0.0.1:2812;
        proxy_set_header Host $host;
      }
    
    }
    

    Please, read more here about how directive location works in nginx