2

I have a subdomain forwarding at IP 192.0.2.1 (example.com) Lets call it nagios.example.com

Nagios worked at 192.0.2.1/nagios but now it's not working due to a fact that app.example.com took over default apache port (:80)

So how to solve my problem? :)

I have almost default nagios config in httpd vhost except i've added <VirtualHost *:80 > and ServerName.

<VirtualHost *:80>
    ServerName nagios.example.com

    ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

    <Directory "/usr/local/nagios/sbin">
    #  SSLRequireSSL
       Options ExecCGI
       AllowOverride None
       Order allow,deny
       Allow from all
    #  Order deny,allow
    #  Deny from all
    #  Allow from 127.0.0.1
       AuthName "Nagios Access"
       AuthType Basic
       AuthUserFile /path/file
       Require valid-user
    </Directory>

    Alias /nagios "/usr/local/nagios/share"

    <Directory "/usr/local/nagios/share">
    #  SSLRequireSSL
       Options None
       AllowOverride None
       Order allow,deny
       Allow from all
    #  Order deny,allow
    #  Deny from all
    #  Allow from 127.0.0.1
       AuthName "Nagios Access"
       AuthType Basic
       AuthUserFile /path/file
       Require valid-user
    </Directory>
</VirtualHost>

PS: httpd -t -D DUMP_VHOSTS

    VirtualHost configuration:    

wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server domain-alias.example (/etc/httpd/conf.d/app.conf:1)
         port 80 namevhost domain-alias.example (/etc/httpd/conf.d/app.conf:1)
         port 80 namevhost nagios.example.com (/etc/httpd/conf.d/nagios.conf:8)
Syntax OK

Sorry for "domain-alias.example" but it's kind of private information :)

14
  • What is output of httpd -t -D DUMP_VHOSTS?
    – cuonglm
    Commented Jun 27, 2014 at 9:24
  • I'm gonna edit my question with answer for your question :)
    – Mr.TK
    Commented Jun 27, 2014 at 9:52
  • @Gnouc : any other ideas? I'm still stuck with this!! :D
    – Mr.TK
    Commented Jul 2, 2014 at 18:15
  • @Mr.TK - do you want both the /nagios URL to work and the nagios.dom.com?
    – slm
    Commented Jul 7, 2014 at 22:06
  • 1
    @Mr.TK - if you need port forwarding you can setup a reverse proxy w/in Apache to handle things like this. The apache mod is called mod_proxy. I might be inclined to solve you issue that way instead of mucking around with moving Nagios all around. There's an example of how to do this here: akerneladay.com/httpd-reverse-proxy-nagiosxi-step-back-in-time
    – slm
    Commented Jul 9, 2014 at 14:42

2 Answers 2

2
+50

If you are using vhost internaly it is always better solution to make vhost configuration with different ports, so in this case you can setup nagios domain on 8083 port: first step: In httpd.conf you need to spicify listening ports:

Listen 8080
Listen 80
Listen 8083

In httpd-vhosts.conf add a NameVirtualHost for every virtual host you want to add.

NameVirtualHost *:80
NameVirtualHost *:8080
NameVirtualHost *:8083

Adopt your documetn root to requested ports and that's it.

After restarting the srevice you can check if ports are open and which app use the same with:

netstat -tlnp
7
  • Listen 8083 NameVirtualHost *:8083 And at vhost: <VirtualHost *:8083> and still nothing :/ Port is opened in iptables.
    – Mr.TK
    Commented Jul 3, 2014 at 8:41
  • Also: i've tried adding 127.0.0.1:8083 nagios.domain.com at /etc/hosts
    – Mr.TK
    Commented Jul 3, 2014 at 8:49
  • which error you have when you issue localhost:8083 in browser ?
    – klerk
    Commented Jul 3, 2014 at 8:55
  • It does work - it's not localhost but still: ip:port = it's working xxxx:8083/nagios
    – Mr.TK
    Commented Jul 3, 2014 at 9:12
  • Sum up: nagios.domain.com is not working (app.domain.com is triggering) , but ip:port/nagios does trigger the nagios)
    – Mr.TK
    Commented Jul 3, 2014 at 9:21
0

Change your port to VirtualHost *:8080 or 81.

see if that works. I had a similar issue with a conflict on my apache server at work and i changed the virtualHost to port 8080 and now everything is runnning fine.

7
  • Solution similar to klerk's solution and same result :D It's not working... :)
    – Mr.TK
    Commented Jul 3, 2014 at 8:52
  • have you looked at your ISP to see if it blocking the original port that you had it on. Sometimes that can happen. Also on you firewall configuration are you allowing ssh and httpd.
    – bgrif
    Commented Jul 3, 2014 at 13:04
  • Yes yes yes :) Other subdomains are done the very same way as I want the nagios.domain.com to work. Firewall is not an issue for sure. :) Nagios is accesbile from xxx.xxx.xxx.xxx:port/nagios thx to klerk's answer.
    – Mr.TK
    Commented Jul 3, 2014 at 13:10
  • I found a post that should help you figure out why it isn't working for you. link They talk about subdomains and why it stopped working and have links to other sights that explain more in detail on how to fix that specific issue.
    – bgrif
    Commented Jul 3, 2014 at 13:17
  • are you running mulitple domain through the same address
    – bgrif
    Commented Jul 3, 2014 at 13:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .