[users@httpd] mod_rewrite RewriteCond

2014-06-27 Thread Michele De Santis
Hi to all,

I'm working with apache 2.2.3-22 and I want to allow access a certain IP 
address. These IP are consecutive

x.x.x.232
x.x.x.233

in my httpd.conf I'm using

RewriteCond %{REMOTE_ADDR} !x\.x\.x\.23[23]$ [NC]RewriteRule \.*$ - [F,NC]
or
RewriteCond %{REMOTE_ADDR} !x\.x\.x\.23[2-3]$ [NC]RewriteRule \.*$ - [F,NC]
but in this way works fine only the first address (232). How can I add the 
another IP (233) in my list of allowed IP?
Thanks 
Michael

   

Re: [users@httpd] mod_rewrite RewriteCond

2014-06-27 Thread Pete Houston
Hello Michael,

The obvious question is why are you using mod_rewrite for access
control in the first place? There are other, lighter modules whose
purpose actually is access control and which will allow you to use CIDR
notation etc.

I suggest you take a look at mod_authz_host instead.

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107


pgpJnVpkw7VdF.pgp
Description: PGP signature


[users@httpd] Execute a python script with CGI ?

2014-06-27 Thread lcelati

Dear all,

1/ On my windows 8, i installed apache 2.2, python 2.7.

I coded a python script. I would like to execute this python script in  
CGI.I would like enable GET pattern only (no POST pattern).


Up to now :

*i edited these following lines of my apache httpd.conf:
--
DocumentRoot "C:\Program Files (x86)\Apache Software  
Foundation\Apache2.2\cgi-bin"
Foundation/Apache2.2/cgi-bin/">

AddHandler cgi-script .cgi .py



*i created a htacess.txt and i pasted it into the file these following lines :

# Interprétation des fichiers .py avant envoi au serveur HTTP
AddHandler cgi-script .py
Options +ExecCGI

# Fichiers index.py : indexes repertoires
DirectoryIndex index.py


* Si i writed a python script (web service with postgresql query). At  
the begining of my script, i added these folloging lines :


import cgitb

cgitb.enable()

print("Content-Type: text/html;charset=utf-8")
print()
print("Hello World!")


=> What do you think about my configuration? I have made ??a mistake?  
I do have one more thing? How to test our CGI? our to ensure that my  
cgi works well?

I would like enable GET pattern only (no POST pattern).

2/ On a 2nd time, i would like to do the same operation (for the same  
python script web service/ GET pattern) but on our remote LINUX server.


=> What is the difference beetween windows and linux configuration?  
Could you throw light for me?


Thanks.

Regards.




-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] R: Re: [users@httpd] mod_rewrite RewriteCond

2014-06-27 Thread Michele De Santis
Thanks Pete,
I was using mod_rewrite in  block. Apache works like a 
reverse-proxy. Is there a way to insert more IP?
Thanks for your advise.
Michael


Messaggio originale
Da: p...@openstrike.co.uk
Data: 27-giu-2014 11.55
A: , "Michele De Santis"
Ogg: Re: [users@httpd] mod_rewrite RewriteCond

Hello Michael,

The obvious question is why are you using mod_rewrite for access
control in the first place? There are other, lighter modules whose
purpose actually is access control and which will allow you to use CIDR
notation etc.

I suggest you take a look at mod_authz_host instead.

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107



   

Re: [users@httpd] mod_rewrite RewriteCond

2014-06-27 Thread Pete Houston
You can set up a reverse proxy and include access control like this:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyRequests Off


ServerName reverse-proxy.example.com

allow from 1.2.3.4 2.2.3.4
deny from all
ProxyPass http://internal.example.com/
ProxyPassReverse http://internal.example.com/



No need for mod_rewrite and in my opinion the configuration is much
clearer to read.

The documentation for proxying is at
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
and for access control is at
http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html
(for the general reader, these are the docs for apache 2.2 which is what
Michael reports he is using. The equivalent docs for up-to-date versions
are under http://httpd.apache.org/docs/2.4/ etc.)

HTH,

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107


pgp03TdNU8zHP.pgp
Description: PGP signature


Re: [users@httpd] Windows Apache 2.4.9 restarts itself

2014-06-27 Thread Jeff Trawick
On Thu, Jun 26, 2014 at 4:18 AM, Mar Imp  wrote:

> Hi,
>
> Thank you for the response!
>
> I looked into child.c, and see that the first line in Error log:
> (OS 6)The handle is invalid.  : AH00356: Child: WAIT_FAILED --
> shutting down server
> comes from:
> child.c Line 1125+: rv = WaitForMultipleObjects(num_events, (HANDLE
> *)child_events, FALSE, ……
> This is the place that causes the restart.
>

Right...  The other code I pointed out is what makes this call different
than before.



>
> The second line in the error log:
> (OS 10038)An operation was attempted on something that is not a
> socket.  : AH00344: accept() failed.
> comes from:
> child.c Line 641+: if (context->accept_socket == INVALID_SOCKET)
> I guess the second line in the error log is just a consequence of the
> server shutting down?
>

I expect so.


>
>
> no, I can’t build httpd. It would be great if you could provide a
> patched version that I could install in _production_ environment.
>
> I can’t reproduce the error on a test server, I can just install the
> version on a productive server, and wait for the error to occur. The
> error occurs sporadically.
>
> It is essential that the patch included in the build doesn’t break
> things (particularly the ability of apache to restart when an error
> happens).
>

The Apache Lounge folks would need to run the build for you to ensure that
it has any patches you're currently using and that the toolchain is in sync.

Right now I hope to make some permanent changes in the next couple of days
to improve diagnostics in this area and commit the changes to httpd trunk.
 At that point you might be able to get the Apache Lounge folks to roll
them into a special build.  ???



>
> As you found out, I use the apachelounge-build atm.
>
> Thank you for your help!
>
> Kind regards
> Maria Imp
>
> 2014-06-24 15:59 GMT+02:00 Jeff Trawick :
> > On Tue, Jun 24, 2014 at 9:36 AM, Mar Imp  wrote:
> >>
> >> I face the problem, that Apache restarts itself unexpecteldy without
> >> obvious reason.
> >>
> >> -> (OS 6)The handle is invalid.  : AH00356: Child: WAIT_FAILED --
> >> shutting down server
> >> -> (OS 10038)An operation was attempted on something that is not a
> >> socket.  : AH00344: accept() failed.
> >>
> >> Apache Version:
> >>   * Problem occurs on 2.4.9, both VC10 and VC11 compiled ones
> >>   * Problem does NOT occur on 2.4.4
> >> Operating System:
> >>   * Microsoft Windows Server 2012 Standard
> >>
> >> The problem occurs since the Apache upgrade from 2.4.4 to 2.4.9.
> >> At this moment I reverted to 2.4.4 again because the random restarts
> >> cause downtimes.
> >>
> >>
> >> Relevant configuration settings:
> >> ThreadsPerChild 300
> >> AcceptFilter http none
> >> AcceptFilter https none
> >> EnableSendfile off
> >> EnableMMAP off
> >>
> >>
> >> Apache works as a caching reverse proxy (mod_cache_disk)
> >>
> >>
> >> Typical logfile fragment:
> >> [log]
> >> [Fri May 23 07:53:58.344457 2014] [mpm_winnt:crit] [pid 42540:tid 380]
> >> (OS 6)The handle is invalid.  : AH00356: Child: WAIT_FAILED --
> >> shutting down server
> >> [Fri May 23 07:54:03.757607 2014] [mpm_winnt:warn] [pid 42540:tid
> >> 4212] (OS 10038)An operation was attempted on something that is not a
> >> socket.  : AH00344: accept() failed.
> >> [Fri May 23 07:54:30.288807 2014] [mpm_winnt:notice] [pid 42540:tid
> >> 380] AH00362: Child: Waiting 270 more seconds for 5 worker threads to
> >> finish.
> >> [Fri May 23 07:55:00.329552 2014] [mpm_winnt:notice] [pid 42540:tid
> >> 380] AH00362: Child: Waiting 240 more seconds for 1 worker threads to
> >> finish.
> >> [Fri May 23 07:55:30.370221 2014] [mpm_winnt:notice] [pid 42540:tid
> >> 380] AH00362: Child: Waiting 210 more seconds for 1 worker threads to
> >> finish.
> >> [Fri May 23 07:55:47.893020 2014] [mpm_winnt:notice] [pid 42540:tid
> >> 380] AH00364: Child: All worker threads have exited.
> >> [Fri May 23 07:55:48.010131 2014] [mpm_winnt:notice] [pid 36544:tid
> >> 516] AH00428: Parent: child process 42540 exited with status 0 --
> >> Restarting.
> >> [Fri May 23 07:55:48.801890 2014] [mpm_winnt:notice] [pid 36544:tid
> >> 516] AH00455: Apache/2.4.9 (Win64) OpenSSL/1.0.1g configured --
> >> resuming normal operations
> >> [Fri May 23 07:55:48.801890 2014] [mpm_winnt:notice] [pid 36544:tid
> >> 516] AH00456: Apache Lounge VC10 Server built: Mar 17 2014 12:11:31
> >> [Fri May 23 07:55:48.801890 2014] [core:notice] [pid 36544:tid 516]
> >> AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
> >> [Fri May 23 07:55:48.802891 2014] [mpm_winnt:notice] [pid 36544:tid
> >> 516] AH00418: Parent: Created child process 33888
> >> [Fri May 23 07:55:50.263291 2014] [mpm_winnt:notice] [pid 33888:tid
> >> 380] AH00354: Child: Starting 300 worker threads.
> >> [Fri May 23 11:58:09.232804 2014] [mpm_winnt:crit] [pid 33888:tid 380]
> >> (OS 6)The handle is invalid.  : AH00356: Child: WAIT_FAILED --
> >> shutting down server
> >> [Fri May 23 11:58:10.710220 2014] [mpm_winnt:warn] [pi

Re: [users@httpd] MaxClients exceeded error message

2014-06-27 Thread Rose, John B
What is the impact of not having a "ListenBacklogs" Directive in your
config?

On 6/26/14 8:01 AM, "Robin Becker"  wrote:

>On 25/06/2014 15:38, Jeff Trawick wrote:
>...
>>> requests.
>>>
>>> What are the effects of MaxClient limit being exceeded?
>>
>>
>> delays in processing new connections
>>
>> depending on load and MaxClients and ListenBacklogs, some new
>>connections
>> might even get rejected
>>
>thanks
>
>
>>
>>> Should I have seen an error message if it was exceeded?
>>
>>
>> once per generation
>>
>> --/--
>>
>> It can be useful to log the response time in microseconds (%D in log
>> format) in order to distinguish delays in the application (delay is
>> reflected in value for %D) from delays before httpd starts processing it
>> due to capacity tuning (delay not reflected in value for %D since it
>> happened before processing started)
>...
>all very useful
>-- 
>Robin Becker
>
>-
>To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
>For additional commands, e-mail: users-h...@httpd.apache.org
>


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] MaxClients exceeded error message

2014-06-27 Thread Pete Houston
On Fri, Jun 27, 2014 at 03:39:42PM +, Rose, John B wrote:
> What is the impact of not having a "ListenBacklogs" Directive in your
> config?

This is covered pretty well in the documentation:
http://httpd.apache.org/docs/2.4/mod/mpm_common.html#listenbacklog

A cursory read of this tells us that the default is 511.

HTH,

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107


pgpaAXFRWo_VA.pgp
Description: PGP signature