Category Archives: apache-utils

NGINX – Why can I bypass password authentication?

I have a NGINX server and I use Apache-utility's for password requirement (.htpasswd). It MOSTLY works fine. The following this work fine:

example.com/admin
example.com/admin/
example.com/admin/index

but... When I type example.com/admin/index.php and don't type any password at all and press "abort" the server show's the index.php (without any CSS or JS files). I think my PHP-FPM is the problem. Please take a look:

location / {
    try_files $uri $uri.html $uri/ @extensionless-php;
    index index.html index.htm index.php;
}

location @extensionless-php {
    rewrite ^(.*)$ $1.php last;
}

location /admin {
    auth_basic "Restricted";
    auth_basic_user_file /admin/.htpasswd;
}

location ~ \.php$ {
    fastcgi_pass            127.0.0.1:9000;
    include                 fastcgi_params;
    fastcgi_param           SCRIPT_FILENAME $document_root$
}

Using ab command, 50 concurent process fails in Linux.

What i have done :

  • I have used following ab command :

ab -n 1000 -c 50 http://192.168.101.143:8558/num?num=5

  • Here, I am trying to generate 1000 http request , 50 concurrent process, port is 8558, and i want factorial of 5 from my server from all the request

  • Another side, My Web Server is waiting for request at that IP address port:8558 and when we execute the ab command server accept the requests and did process gives result factorial of 5 in response but some of 20-25 request fails every time in Linux.

  • But When, I am run my server on windows platform is is working fine, it give 1000 correct response with 50 concurrent process on time without fail any request.

Problem:

  • In windows 50 concurrent process working fine but Linux some request fails, why?
  • Is there any socket limit opening in Linux at a time?
  • How to solve this issue for Linux?

When Server on in Windows Platform:

This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.101.143 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        
Server Hostname:        192.168.101.143
Server Port:            8558

Document Path:          /num?num=5
Document Length:        3 bytes

Concurrency Level:      50
Time taken for tests:   2.310 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      123000 bytes
HTML transferred:       3000 bytes
Requests per second:    432.93 [#/sec] (mean)
Time per request:       115.493 [ms] (mean)
Time per request:       2.310 [ms] (mean, across all concurrent requests)
Transfer rate:          52.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   1.6      1      12
Processing:     4   64 117.5     25    1803
Waiting:        2   39  74.4     16    1281
Total:          5   66 117.8     26    1810

Percentage of the requests served within a certain time (ms)
  50%     26
  66%     42
  75%     78
  80%     93
  90%    171
  95%    218
  98%    358
  99%    536
 100%   1810 (longest request)

When Server Running in Linux Platform:

This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.101.143 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        
Server Hostname:        192.168.101.143
Server Port:            8558

Document Path:          /num?num=5
Document Length:        3 bytes

Concurrency Level:      50
Time taken for tests:   18.899 seconds
Complete requests:      1000
Failed requests:        26
   (Connect: 0, Receive: 0, Length: 26, Exceptions: 0)
Total transferred:      119802 bytes
HTML transferred:       2922 bytes
Requests per second:    52.91 [#/sec] (mean)
Time per request:       944.934 [ms] (mean)
Time per request:       18.899 [ms] (mean, across all concurrent requests)
Transfer rate:          6.19 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4   3.0      3      21
Processing:     2  346 2206.7      7   18823
Waiting:        0   76 657.4      6    6371
Total:          3  350 2206.7     10   18827

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     12
  75%     15
  80%     17
  90%     26
  95%     39
  98%   6341
  99%  18820
 100%  18827 (longest request)
[email protected]:~/Dhvani

Use Apache Utils httxt2dbm to convert text files that contains Unicode characters

I tried to use Apache Utils httxt2dbm to convert a text file to DBM format, as suggested by Apache documentation on RewriteMap. The command is as follow:

httxt2dbm -i rewrite.txt -o rewrite.map

The contents of rewrite.txt is as follow:

駅トイレに首相 1
幻の「震電」 2

Just an example. The text file contains non-ASCII characters. Once I executed the command mentioned above, it said:

BDB0004 fop_read_meta: rewrite.map: unexpected file type or format

How do I use Unicode-character-contained files in httxt2dbm command?

p.s. works fine in ASCII files

Use Apache Utils httxt2dbm to convert text files that contains Unicode characters

I tried to use Apache Utils httxt2dbm to convert a text file to DBM format, as suggested by Apache documentation on RewriteMap. The command is as follow:

httxt2dbm -i rewrite.txt -o rewrite.map

The contents of rewrite.txt is as follow:

駅トイレに首相 1
幻の「震電」 2

Just an example. The text file contains non-ASCII characters. Once I executed the command mentioned above, it said:

BDB0004 fop_read_meta: rewrite.map: unexpected file type or format

How do I use Unicode-character-contained files in httxt2dbm command?

p.s. works fine in ASCII files