Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a fully new install nagios, but I can't access to it.

Here's my Nginx config:

server{
    listen 80;
    server_name  [redacted];

    # blahblah

    # Nagios Monitoring
    location /nagios3/ {
      proxy_pass  http://127.0.0.1:80;
    }
}

Nagios is installed step by step(From this Linode guide):

sudo apt-get install -y nagios3

Then I try to visit http://ip-address/nagios3/, but it shows 502 bad gateway. How do I deal with this ?

This is my /var/log/syslog:

Oct 25 14:18:17 my-server nagios3: SERVICE ALERT: localhost;Disk Space;WARNING;SOFT;1;DISK WARNING - free space: /boot 43 MB (20% inode=99%):
Oct 25 14:19:07 my-server nagios3: SERVICE ALERT: localhost;HTTP;WARNING;SOFT;1;HTTP WARNING: HTTP/1.1 403 Forbidden - 319 bytes in 0.000 second response time
Oct 25 14:19:17 my-server nagios3: SERVICE ALERT: localhost;Disk Space;WARNING;SOFT;2;DISK WARNING - free space: /boot 43 MB (20% inode=99%):
Oct 25 14:20:07 my-server nagios3: SERVICE ALERT: localhost;HTTP;WARNING;SOFT;2;HTTP WARNING: HTTP/1.1 403 Forbidden - 319 bytes in 0.000 second response time
Oct 25 14:20:17 my-server nagios3: SERVICE ALERT: localhost;Disk Space;WARNING;SOFT;3;DISK WARNING - free space: /boot 43 MB (20% inode=99%):
Oct 25 14:21:07 my-server nagios3: SERVICE ALERT: localhost;HTTP;WARNING;SOFT;3;HTTP WARNING: HTTP/1.1 403 Forbidden - 319 bytes in 0.000 second response time
Oct 25 14:21:17 my-server nagios3: SERVICE ALERT: localhost;Disk Space;WARNING;HARD;4;DISK WARNING - free space: /boot 43 MB (20% inode=99%):
Oct 25 14:21:17 my-server nagios3: SERVICE NOTIFICATION: root;localhost;Disk Space;WARNING;notify-service-by-email;DISK WARNING - free space: /boot 43 MB (20% inode=99%):
Oct 25 14:21:17 my-server postfix/pickup[24474]: 4F89F394034C: uid=109 from=<nagios>
Oct 25 14:21:17 my-server postfix/cleanup[27756]: 4F89F394034C: message-id=<20131025062117.4F89F394034C@my-server>
Oct 25 14:21:17 my-server postfix/qmgr[24475]: 4F89F394034C: from=<nagios@nagios@myserver-1.info>, size=594, nrcpt=1 (queue active)
Oct 25 14:21:17 my-server postfix/local[27758]: 4F89F394034C: to=<root@localhost>, relay=local, delay=0.15, delays=0.11/0/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 25 14:21:17 my-server postfix/qmgr[24475]: 4F89F394034C: removed
Oct 25 14:22:07 my-server nagios3: SERVICE ALERT: localhost;HTTP;WARNING;HARD;4;HTTP WARNING: HTTP/1.1 403 Forbidden - 319 bytes in 0.000 second response time
Oct 25 14:22:07 my-server nagios3: SERVICE NOTIFICATION: root;localhost;HTTP;WARNING;notify-service-by-email;HTTP WARNING: HTTP/1.1 403 Forbidden - 319 bytes in 0.000 second response time
Oct 25 14:22:07 my-server postfix/pickup[24474]: 219CA3940381: uid=109 from=<nagios>
Oct 25 14:22:07 my-server postfix/cleanup[27756]: 219CA3940381: message-id=<20131025062207.219CA3940381@my-server>
Oct 25 14:22:07 my-server postfix/qmgr[24475]: 219CA3940381: from=<nagios@nagios@myserver-1.info>, size=605, nrcpt=1 (queue active)
Oct 25 14:22:07 my-server postfix/local[27758]: 219CA3940381: to=<root@localhost>, relay=local, delay=0.12, delays=0.07/0/0/0.05, dsn=2.0.0, status=sent (delivered to mailbox)
Oct 25 14:22:07 my-server postfix/qmgr[24475]: 219CA3940381: removed
Oct 25 14:39:01 my-server CRON[28242]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete)

And there're lot of 127.0.0.1 visit in nginx log, but I actually visit from a external ip:

127.0.0.1 - - [25/Oct/2013:14:21:02 +0800] "GET /nagios3/ HTTP/1.0" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/3      0.0.1599.69 Safari/537.36"
127.0.0.1 - - [25/Oct/2013:14:21:02 +0800] "GET /nagios3/ HTTP/1.0" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/3      0.0.1599.69 Safari/537.36"
127.0.0.1 - - [25/Oct/2013:14:21:02 +0800] "GET /nagios3/ HTTP/1.0" 502 575 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/3      0.0.1599.69 Safari/537.36"
share|improve this question
    
Configuring Nagios in Apache may be straightforward as mentioned in that Linode article. It isn't the same with Nginx. You may have a look at this sample configuration (gist.github.com/mrbichel/1754118) and customize it for your specific use-case. –  Pothi Oct 25 '13 at 7:10
1  
I can't avoid noticing that you set nginx to listen on port 80, and you're trying to proxy the request to itself at port 80 in the proxy_pass directive. That is the reason your log is showing 127.0.0.1 –  AdyR Oct 26 '13 at 7:13
    
As AdyR mentioned... it looks like you're very confused. If you don't know how to configure nginx, you should probably stick with the apache2 package, since Nagios ships with conf for it. –  Keith Oct 28 '13 at 15:13

1 Answer 1

you forgot to start apache: sudo /etc/init.d/apache2 start

and you should set:

server_tokens off;

in your nginx.conf

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.