You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Josu Lazkano <jo...@barcelonamedia.org> on 2011/07/21 17:28:43 UTC

[users@httpd] Monit on vhost

Hello list, I am trying to configure a server with lots of vhost.

I need to check if they are online with Monit, for this, I just create this on each vhost:

        Alias /monit/ /var/www/monit/
        <Directory "/var/www/monit/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from all
        </Directory>

So, I just add on the Monit lines like this:

   #domain1
   if failed host domain1.com port 80 protocol http and request "/monit/token" then alert
   if failed host www.domain1s.com port 80 protocol http and request "/monit/token" then alert

   #domain2
   if failed host domain2.com port 80 protocol http and request "/monit/token" then alert
   if failed host www.domain2.com port 80 protocol http and request "/monit/token" then alert

There is a "token" file on /var/www/monit/ so, if Monit can not get this file it send an alert.

The Monit service is on localhost, so I just want to get access to this directory just localhost.

How could I do that?

Thanks for all your help and best regards.

RE: [users@httpd] Monit on vhost

Posted by Josu Lazkano <jo...@barcelonamedia.org>.
Thanks!!!

I change localhost to public Ip and it works!

Thanks for your help, best regards.

-----Mensaje original-----
De: Jeroen Geilman [mailto:jeroen@adaptr.nl] 
Enviado el: lunes, 25 de julio de 2011 19:33
Para: users@httpd.apache.org
Asunto: Re: [users@httpd] Monit on vhost

On 2011-07-25 10:34, Josu Lazkano wrote:
> Thanks for your help.
>
> I try it but it does not work.
>
> I configure this way:
>
>          Alias /monit/token /var/www/monit/token
>          <Directory "/var/www/monit/">
>                  Options none
>                  AllowOverride None
>                  Order allow,deny
>                  Allow from 127.0.0.1
>          </Directory>
>
> Then I reload Apache and if I try to download the "token" from same machine I get this:
>
> $ wget http://domain1.com/monit/token
> --2011-07-25 10:30:21--  http://dicore2s.com/monit/token
> Resolving domain1.com... x.x.x.x (server public IP)
> Connecting to domain1.com|x.x.x.x|:80... connected.
> HTTP request sent, awaiting response... 403 Forbidden
> 2011-07-25 10:30:21 ERROR 403: Forbidden.

You're not requesting the resource from localhost.
Either you have to allow access from the external IP, or clone all those 
vhosts to live on localhost as well.

> If I change the site configuration this way:
>
> $ wget http://domain1.com/monit/token
> --2011-07-25 10:32:24--  http://domain1.com/monit/token
> Resolving domain1.com... x.x.x.x
> Connecting to domain1.com|x.x.x.x|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 17 [text/plain]
> Saving to: `token'
>
> 100%[======================================>] 17          --.-K/s   in 0s
>
> 2011-07-25 10:32:24 (3.35 MB/s) - `token' saved [17/17]
>
> And it works well, but it is accessible to everyone.
>
> How could I solve this?
>
> Thanks for all your help and best regards.
>
> -----Mensaje original-----
> De: Jeroen Geilman [mailto:jeroen@adaptr.nl]
> Enviado el: viernes, 22 de julio de 2011 19:04
> Para: users@httpd.apache.org
> Asunto: Re: [users@httpd] Monit on vhost
>
> On 2011-07-22 09:46, Josu Lazkano wrote:
>
> 	Thanks for your reply, can you help with an example?
>
>
> OUTSIDE your vhosts:
>
>         Alias /monit/token /var/www/monit/token
>
>          <Directory "/var/www/monit/">
>
>                  Options none
>
>                  AllowOverride None
>
>                  Order allow,deny
>
>                  Allow from 127.0.0.1
>          </Directory>
>
>
>
> 	I am new on Apache and I just copy examples from the web.
>
> 	
>
> 	Thanks and best regards.
>
> 	
>
> 	De: Jeroen Geilman [mailto:jeroen@adaptr.nl]
> 	Enviado el: jueves, 21 de julio de 2011 20:55
> 	Para: users@httpd.apache.org
> 	Asunto: Re: [users@httpd] Monit on vhost
>
> 	
>
> 	On 2011-07-21 17:28, Josu Lazkano wrote:
>
> 	Hello list, I am trying to configure a server with lots of vhost.
>
> 	
>
> 	I need to check if they are online with Monit, for this, I just create this on each vhost:
>
> 	
>
> 	        Alias /monit/ /var/www/monit/
>
> 	<Directory "/var/www/monit/">
>
> 	Options Indexes MultiViews FollowSymLinks
>
> 	                AllowOverride None
>
> 	                Order deny,allow
>
> 	                Deny from all
>
> 	                Allow from all
>
> 	</Directory>
>
> 	
>
> 	So, I just add on the Monit lines like this:
>
> 	
>
> 	   #domain1
>
> 	   if failed host domain1.com port 80 protocol http and request "/monit/token" then alert
>
> 	   if failed host www.domain1s.com port 80 protocol http and request "/monit/token" then alert
>
> 	
>
> 	   #domain2
>
> 	   if failed host domain2.com port 80 protocol http and request "/monit/token" then alert
>
> 	   if failed host www.domain2.com port 80 protocol http and request "/monit/token" then alert
>
> 	
>
> 	There is a "token" file on /var/www/monit/ so, if Monit can not get this file it send an alert.
>
> 	
>
> 	The Monit service is on localhost, so I just want to get access to this directory just localhost.
>
> 	
>
> 	How could I do that?
>
> 	
> 	By not allowing from All, obviously.
> 	
> 	You could also simplify the shit out of this by defining the directory and alias ONCE, outside any vhost.
> 	
> 	And alias only /monit/token, since that is apparently all that is requested.
> 	
> 	
> 	
>
> 	--
> 	J.
>
>
>


-- 
J.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Monit on vhost

Posted by Jeroen Geilman <je...@adaptr.nl>.
On 2011-07-25 10:34, Josu Lazkano wrote:
> Thanks for your help.
>
> I try it but it does not work.
>
> I configure this way:
>
>          Alias /monit/token /var/www/monit/token
>          <Directory "/var/www/monit/">
>                  Options none
>                  AllowOverride None
>                  Order allow,deny
>                  Allow from 127.0.0.1
>          </Directory>
>
> Then I reload Apache and if I try to download the "token" from same machine I get this:
>
> $ wget http://domain1.com/monit/token
> --2011-07-25 10:30:21--  http://dicore2s.com/monit/token
> Resolving domain1.com... x.x.x.x (server public IP)
> Connecting to domain1.com|x.x.x.x|:80... connected.
> HTTP request sent, awaiting response... 403 Forbidden
> 2011-07-25 10:30:21 ERROR 403: Forbidden.

You're not requesting the resource from localhost.
Either you have to allow access from the external IP, or clone all those 
vhosts to live on localhost as well.

> If I change the site configuration this way:
>
> $ wget http://domain1.com/monit/token
> --2011-07-25 10:32:24--  http://domain1.com/monit/token
> Resolving domain1.com... x.x.x.x
> Connecting to domain1.com|x.x.x.x|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 17 [text/plain]
> Saving to: `token'
>
> 100%[======================================>] 17          --.-K/s   in 0s
>
> 2011-07-25 10:32:24 (3.35 MB/s) - `token' saved [17/17]
>
> And it works well, but it is accessible to everyone.
>
> How could I solve this?
>
> Thanks for all your help and best regards.
>
> -----Mensaje original-----
> De: Jeroen Geilman [mailto:jeroen@adaptr.nl]
> Enviado el: viernes, 22 de julio de 2011 19:04
> Para: users@httpd.apache.org
> Asunto: Re: [users@httpd] Monit on vhost
>
> On 2011-07-22 09:46, Josu Lazkano wrote:
>
> 	Thanks for your reply, can you help with an example?
>
>
> OUTSIDE your vhosts:
>
>         Alias /monit/token /var/www/monit/token
>
>          <Directory "/var/www/monit/">
>
>                  Options none
>
>                  AllowOverride None
>
>                  Order allow,deny
>
>                  Allow from 127.0.0.1
>          </Directory>
>
>
>
> 	I am new on Apache and I just copy examples from the web.
>
> 	
>
> 	Thanks and best regards.
>
> 	
>
> 	De: Jeroen Geilman [mailto:jeroen@adaptr.nl]
> 	Enviado el: jueves, 21 de julio de 2011 20:55
> 	Para: users@httpd.apache.org
> 	Asunto: Re: [users@httpd] Monit on vhost
>
> 	
>
> 	On 2011-07-21 17:28, Josu Lazkano wrote:
>
> 	Hello list, I am trying to configure a server with lots of vhost.
>
> 	
>
> 	I need to check if they are online with Monit, for this, I just create this on each vhost:
>
> 	
>
> 	        Alias /monit/ /var/www/monit/
>
> 	<Directory "/var/www/monit/">
>
> 	Options Indexes MultiViews FollowSymLinks
>
> 	                AllowOverride None
>
> 	                Order deny,allow
>
> 	                Deny from all
>
> 	                Allow from all
>
> 	</Directory>
>
> 	
>
> 	So, I just add on the Monit lines like this:
>
> 	
>
> 	   #domain1
>
> 	   if failed host domain1.com port 80 protocol http and request "/monit/token" then alert
>
> 	   if failed host www.domain1s.com port 80 protocol http and request "/monit/token" then alert
>
> 	
>
> 	   #domain2
>
> 	   if failed host domain2.com port 80 protocol http and request "/monit/token" then alert
>
> 	   if failed host www.domain2.com port 80 protocol http and request "/monit/token" then alert
>
> 	
>
> 	There is a "token" file on /var/www/monit/ so, if Monit can not get this file it send an alert.
>
> 	
>
> 	The Monit service is on localhost, so I just want to get access to this directory just localhost.
>
> 	
>
> 	How could I do that?
>
> 	
> 	By not allowing from All, obviously.
> 	
> 	You could also simplify the shit out of this by defining the directory and alias ONCE, outside any vhost.
> 	
> 	And alias only /monit/token, since that is apparently all that is requested.
> 	
> 	
> 	
>
> 	--
> 	J.
>
>
>


-- 
J.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Monit on vhost

Posted by Josu Lazkano <jo...@barcelonamedia.org>.
Thanks for your help.

I try it but it does not work.

I configure this way:

        Alias /monit/token /var/www/monit/token
        <Directory "/var/www/monit/">
                Options none
                AllowOverride None
                Order allow,deny
                Allow from 127.0.0.1
        </Directory>

Then I reload Apache and if I try to download the "token" from same machine I get this:

$ wget http://domain1.com/monit/token
--2011-07-25 10:30:21--  http://dicore2s.com/monit/token
Resolving domain1.com... x.x.x.x (server public IP)
Connecting to domain1.com|x.x.x.x|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2011-07-25 10:30:21 ERROR 403: Forbidden.

If I change the site configuration this way:

$ wget http://domain1.com/monit/token
--2011-07-25 10:32:24--  http://domain1.com/monit/token
Resolving domain1.com... x.x.x.x
Connecting to domain1.com|x.x.x.x|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17 [text/plain]
Saving to: `token'

100%[======================================>] 17          --.-K/s   in 0s

2011-07-25 10:32:24 (3.35 MB/s) - `token' saved [17/17]

And it works well, but it is accessible to everyone.

How could I solve this?

Thanks for all your help and best regards.

-----Mensaje original-----
De: Jeroen Geilman [mailto:jeroen@adaptr.nl] 
Enviado el: viernes, 22 de julio de 2011 19:04
Para: users@httpd.apache.org
Asunto: Re: [users@httpd] Monit on vhost

On 2011-07-22 09:46, Josu Lazkano wrote: 

	Thanks for your reply, can you help with an example?


OUTSIDE your vhosts:

       Alias /monit/token /var/www/monit/token 

        <Directory "/var/www/monit/">

                Options none

                AllowOverride None

                Order allow,deny

                Allow from 127.0.0.1
        </Directory>



	I am new on Apache and I just copy examples from the web.

	 

	Thanks and best regards.

	 

	De: Jeroen Geilman [mailto:jeroen@adaptr.nl] 
	Enviado el: jueves, 21 de julio de 2011 20:55
	Para: users@httpd.apache.org
	Asunto: Re: [users@httpd] Monit on vhost

	 

	On 2011-07-21 17:28, Josu Lazkano wrote: 

	Hello list, I am trying to configure a server with lots of vhost.

	 

	I need to check if they are online with Monit, for this, I just create this on each vhost:

	 

	        Alias /monit/ /var/www/monit/

	        <Directory "/var/www/monit/">

	                Options Indexes MultiViews FollowSymLinks

	                AllowOverride None

	                Order deny,allow

	                Deny from all

	                Allow from all

	        </Directory>

	 

	So, I just add on the Monit lines like this:

	 

	   #domain1

	   if failed host domain1.com port 80 protocol http and request "/monit/token" then alert

	   if failed host www.domain1s.com port 80 protocol http and request "/monit/token" then alert

	 

	   #domain2

	   if failed host domain2.com port 80 protocol http and request "/monit/token" then alert

	   if failed host www.domain2.com port 80 protocol http and request "/monit/token" then alert

	 

	There is a "token" file on /var/www/monit/ so, if Monit can not get this file it send an alert.

	 

	The Monit service is on localhost, so I just want to get access to this directory just localhost.

	 

	How could I do that?

	
	By not allowing from All, obviously.
	
	You could also simplify the shit out of this by defining the directory and alias ONCE, outside any vhost.
	
	And alias only /monit/token, since that is apparently all that is requested.
	
	
	

	-- 
	J.



-- 
J.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Monit on vhost

Posted by Jeroen Geilman <je...@adaptr.nl>.
On 2011-07-22 09:46, Josu Lazkano wrote:
>
> Thanks for your reply, can you help with an example?
>

OUTSIDE your vhosts:

        Alias /monit/token /var/www/monit/token

<Directory "/var/www/monit/">

                 Options none

                 AllowOverride None

                 Order allow,deny

                 Allow from 127.0.0.1
</Directory>

> I am new on Apache and I just copy examples from the web.
>
> Thanks and best regards.
>
> *De:*Jeroen Geilman [mailto:jeroen@adaptr.nl]
> *Enviado el:* jueves, 21 de julio de 2011 20:55
> *Para:* users@httpd.apache.org
> *Asunto:* Re: [users@httpd] Monit on vhost
>
> On 2011-07-21 17:28, Josu Lazkano wrote:
>
> Hello list, I am trying to configure a server with lots of vhost.
>
> I need to check if they are online with Monit, for this, I just create 
> this on each vhost:
>
>         Alias /monit/ /var/www/monit/
>
> <Directory "/var/www/monit/">
>
>                 Options Indexes MultiViews FollowSymLinks
>
>                 AllowOverride None
>
>                 Order deny,allow
>
>                 Deny from all
>
>                 Allow from all
>
> </Directory>
>
> So, I just add on the Monit lines like this:
>
>    #domain1
>
>    if failed host domain1.com port 80 protocol http and request 
> "/monit/token" then alert
>
>    if failed host www.domain1s.com <http://www.domain1s.com> port 80 
> protocol http and request "/monit/token" then alert
>
>    #domain2
>
>    if failed host domain2.com port 80 protocol http and request 
> "/monit/token" then alert
>
>    if failed host www.domain2.com <http://www.domain2.com> port 80 
> protocol http and request "/monit/token" then alert
>
> There is a "token" file on /var/www/monit/ so, if Monit can not get 
> this file it send an alert.
>
> The Monit service is on localhost, so I just want to get access to 
> this directory just localhost.
>
> How could I do that?
>
>
> By not allowing from All, obviously.
>
> You could also simplify the shit out of this by defining the directory 
> and alias ONCE, outside any vhost.
>
> And alias only /monit/token, since that is apparently all that is 
> requested.
>
>
> -- 
> J.


-- 
J.


RE: [users@httpd] Monit on vhost

Posted by Josu Lazkano <jo...@barcelonamedia.org>.
Thanks for your reply, can you help with an example? I am new on Apache and I just copy examples from the web.

Thanks and best regards.

De: Jeroen Geilman [mailto:jeroen@adaptr.nl]
Enviado el: jueves, 21 de julio de 2011 20:55
Para: users@httpd.apache.org
Asunto: Re: [users@httpd] Monit on vhost

On 2011-07-21 17:28, Josu Lazkano wrote:
Hello list, I am trying to configure a server with lots of vhost.

I need to check if they are online with Monit, for this, I just create this on each vhost:

        Alias /monit/ /var/www/monit/
        <Directory "/var/www/monit/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from all
        </Directory>

So, I just add on the Monit lines like this:

   #domain1
   if failed host domain1.com port 80 protocol http and request "/monit/token" then alert
   if failed host www.domain1s.com<http://www.domain1s.com> port 80 protocol http and request "/monit/token" then alert

   #domain2
   if failed host domain2.com port 80 protocol http and request "/monit/token" then alert
   if failed host www.domain2.com<http://www.domain2.com> port 80 protocol http and request "/monit/token" then alert

There is a "token" file on /var/www/monit/ so, if Monit can not get this file it send an alert.

The Monit service is on localhost, so I just want to get access to this directory just localhost.

How could I do that?

By not allowing from All, obviously.

You could also simplify the shit out of this by defining the directory and alias ONCE, outside any vhost.

And alias only /monit/token, since that is apparently all that is requested.



--

J.

Re: [users@httpd] Monit on vhost

Posted by Jeroen Geilman <je...@adaptr.nl>.
On 2011-07-21 17:28, Josu Lazkano wrote:
>
> Hello list, I am trying to configure a server with lots of vhost.
>
> I need to check if they are online with Monit, for this, I just create 
> this on each vhost:
>
>         Alias /monit/ /var/www/monit/
>
> <Directory "/var/www/monit/">
>
>                 Options Indexes MultiViews FollowSymLinks
>
>                 AllowOverride None
>
>                 Order deny,allow
>
>                 Deny from all
>
>                 Allow from all
>
> </Directory>
>
> So, I just add on the Monit lines like this:
>
>    #domain1
>
>    if failed host domain1.com port 80 protocol http and request 
> "/monit/token" then alert
>
>    if failed host www.domain1s.com port 80 protocol http and request 
> "/monit/token" then alert
>
>    #domain2
>
>    if failed host domain2.com port 80 protocol http and request 
> "/monit/token" then alert
>
>    if failed host www.domain2.com port 80 protocol http and request 
> "/monit/token" then alert
>
> There is a "token" file on /var/www/monit/ so, if Monit can not get 
> this file it send an alert.
>
> The Monit service is on localhost, so I just want to get access to 
> this directory just localhost.
>
> How could I do that?
>

By not allowing from All, obviously.

You could also simplify the shit out of this by defining the directory 
and alias ONCE, outside any vhost.

And alias only /monit/token, since that is apparently all that is requested.

-- 
J.