<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.chty.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Chty blog - Apache2</title>
  <link>http://blog.chty.org/</link>
  <atom:link href="http://blog.chty.org/feed/tag/Apache2/rss2" rel="self" type="application/rss+xml"/>
  <description>A little somewhere else...</description>
  <language>en</language>
  <pubDate>Sun, 20 Jul 2008 15:29:28 +0200</pubDate>
  <copyright>Creative Commons</copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Generating certificates with openssl</title>
    <link>http://blog.chty.org/post/2008/03/20/Generating-certificates-with-openssl</link>
    <guid isPermaLink="false">urn:md5:680dab73191ad60ee2bd513e6cc18191</guid>
    <pubDate>Thu, 20 Mar 2008 21:55:00 +0100</pubDate>
    <dc:creator>Chty</dc:creator>
        <category>Apache2</category><category>debian</category>    
    <description>    &lt;p&gt;I'm sometimes using &lt;a href=&quot;http://www.openssl.org/&quot;&gt;openssl&lt;/a&gt; to generate certificates, mostly for &lt;a href=&quot;http://www.apache.org/&quot;&gt;apache&lt;/a&gt; but not enough to remember the complete shell command each time. So I paste it here, as a reminder.&lt;/p&gt;


&lt;p&gt;&lt;code&gt;openssl req -new &amp;gt; server.cert.csr&lt;br /&gt;openssl rsa -in privkey.pem -out server.cert.key&lt;br /&gt;openssl x509 -in server.cert.csr -out server.cert.crt -req -signkey server.cert.key -days 365&lt;/code&gt;&lt;/p&gt;


&lt;p&gt;Theses commands generate .pem, .crt, .csr and .key files.
Note that apache only require .crt and .key files for SSLCertificateFile, SSLCertificateKeyFile directives.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Apache2 + mod_fastcgi + suexec on debian etch</title>
    <link>http://blog.chty.org/post/2007/10/28/Apache2-mod_fastcgi-suexec-on-debian-etch</link>
    <guid isPermaLink="false">urn:md5:451a38a518ef53081658f9bd988cf77e</guid>
    <pubDate>Mon, 29 Oct 2007 14:49:00 +0100</pubDate>
    <dc:creator>Chty</dc:creator>
        <category>Apache2</category><category>debian</category><category>fastcgi</category><category>howto</category><category>php</category><category>suexec</category>    
    <description>&lt;p&gt;I know it's difficult to find good documentation to configure &lt;a href=&quot;http://blog.chty.org/tag/Apache2&quot;&gt;apache2&lt;/a&gt; with &lt;a hreflang=&quot;en&quot; href=&quot;http://fastcgi.com&quot;&gt;mod_fastcgi&lt;/a&gt; and &lt;a hreflang=&quot;en&quot; href=&quot;http://httpd.apache.org&quot;&gt;suexec&lt;/a&gt; to make php websites works. This
configuration works well with Debian Etch (4.0).&lt;br /&gt;Here an example of configuration.&lt;/p&gt;    The following suppose that your web data are in /var/www/ (there are good reason for this as we'll see later).&lt;br /&gt;/var/www/toto/: the web account of toto&lt;br /&gt;/var/www/toto/web/: the web dir of the toto's account&lt;br /&gt;/var/www/toto/conf/php.ini: you own php.ini file&lt;br /&gt;/var/www/toto/cgi-bin/php.fcgi: the fcgi file which allow to run &lt;a hreflang=&quot;en&quot; href=&quot;http://php.net/&quot;&gt;php5-cgi&lt;/a&gt; with a specific php.ini file for each virtual host&lt;br /&gt;&lt;br /&gt;First of all don't forget that mod_fastcgi and mod_fcgid are different. Difference between &lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt; and &lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt; is mostly at license level, since some might consider mod_fastcgi not to be totally free.&lt;br /&gt;&lt;br /&gt;Enable fastcgi and suexec:&lt;br /&gt;&lt;code&gt;#a2enmod fastcgi&lt;br /&gt;#a2enmod suexec&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Suexec has no configuration file, because every parameter is hardcoded. Therefore, if you need to configure suexec, do it at apache2 compile time.&lt;br /&gt;Let's see how...&lt;br /&gt;&lt;br /&gt;&lt;code&gt;#/usr/lib/apache2/suexec -V &lt;br /&gt;&amp;nbsp;-D AP_DOC_ROOT=&quot;/var/www&quot;&lt;br /&gt;&amp;nbsp;-D AP_GID_MIN=100&lt;br /&gt;&amp;nbsp;-D AP_HTTPD_USER=&quot;www-data&quot;&lt;br /&gt;&amp;nbsp;-D AP_LOG_EXEC=&quot;/var/log/apache2/suexec.log&quot;&lt;br /&gt;&amp;nbsp;-D AP_SAFE_PATH=&quot;/usr/local/bin:/usr/bin:/bin&quot;&lt;br /&gt;&amp;nbsp;-D AP_UID_MIN=100&lt;br /&gt;&amp;nbsp;-D AP_USERDIR_SUFFIX=&quot;public_html&quot;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;AP_DOC_ROOT is set to &quot;/var/www&quot;, which is the reason you would want to put your files in /var/www/. You cannot just ignore this fact; if this directory is inconsistently set, it just won't work. If you want to change this directory, you must recompile apache2 with your own configuration.&lt;br /&gt;&lt;br /&gt;/var/www/toto/cgi-bin/php.fcgi:&lt;br /&gt;&lt;code&gt;#!/bin/sh&lt;br /&gt;PHPRC=&quot;/var/www/toto/conf/&quot;&lt;br /&gt;export PHPRC&lt;br /&gt;PHP_FCGI_CHILDREN=4&lt;br /&gt;export PHP_FCGI_CHILDREN&lt;br /&gt;PHP_FCGI_MAX_REQUESTS=200&lt;br /&gt;export PHP_FCGI_MAX_REQUESTS&lt;br /&gt;exec /usr/bin/php5-cgi&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;fastcgi.conf: (in /etc/apache2/mods-available/ for Debian)&lt;br /&gt;
&lt;code&gt;&amp;lt;IfModule mod_fastcgi.c&amp;gt;&lt;br /&gt;&amp;nbsp;AddHandler fastcgi-script .fcgi&lt;br /&gt;&amp;nbsp;FastCgiWrapper /usr/lib/apache2/suexec&lt;br /&gt;&amp;nbsp;FastCgiIpcDir /var/lib/apache2/fastcgi&lt;br /&gt;&amp;nbsp;FastCgiConfig -singleThreshold 1 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION&lt;br /&gt;&amp;lt;/IfModule&amp;gt;&lt;br /&gt;&lt;br /&gt;
&lt;/code&gt;
See &lt;a hreflang=&quot;en&quot; href=&quot;http://www.fastcgi.com/&quot;&gt;http://www.fastcgi.com/&lt;/a&gt; if you want to know about all the options possible in fastcgi.conf.&lt;br /&gt;&lt;br /&gt;Let's configure (in /etc/apache2/sites-available/  for debian etch) a virtual host for toto:&lt;code&gt;&lt;br /&gt;
&amp;lt;VirtualHost xxx.xxx.xxx.xxx:80&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerAdmin webmaster@toto.org&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerName toto.org&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentRoot /var/www/toto/web/&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; SuexecUserGroup UserName GroupName&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Options FollowSymLinks&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AllowOverride None&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory /var/www/toto/web/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Options -Indexes FollowSymLinks -MultiViews&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AllowOverride all&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order allow,deny&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Allow from all&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ScriptAlias /cgi-bin/ /var/www/toto/cgi-bin/&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Directory &quot;/var/www/toto/cgi-bin/&quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AllowOverride None&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Options ExecCGI -MultiViews +SymLinksIfOwnerMatch&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order allow,deny&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Allow from all&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; AddHandler php-fastcgi .php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AddType application/x-httpd-php .php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DirectoryIndex index.html index.php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Action php-fastcgi /cgi-bin/php.fcgi&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServerSignature On&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&lt;/code&gt;&lt;span class=&quot;q&quot; id=&quot;q_115e6f9f561c4168_16&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style=&quot;direction: ltr;&quot;&gt;This virtual host can be enabled in /etc/apache2/sites-enabled/ by creating a symbolic link.&lt;br /&gt;Make sure to set appropriate rights for /var/www/toto/ you set in the virtual host (SuexecUserGroup), since &lt;a href=&quot;http://blog.chty.org/tag/php&quot;&gt;php5-cgi&lt;/a&gt; will be executed with these rights.&lt;/div&gt;&lt;br /&gt;restart apache2 :&lt;br /&gt;&lt;code&gt;#/etc/init.d/apache2 restart&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;A maximum of four php5-cgi will be launched when the first visitor will visit the website. They would be killed after a timeout of 240 seconds of inactivity, as set in fastcgi.conf.&lt;br /&gt;It should work.&lt;br /&gt;Please tell me know if you are aware of issue that may arise with such a configuration.&lt;br /&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Apache2 - mod_fcgid vs mod_fastcgi</title>
    <link>http://blog.chty.org/post/2007/10/08/151-apache2-mod_fcgid-vs-mod_fastcgi</link>
    <guid isPermaLink="false">urn:md5:55ff690f4a0a5845013a0d8a5b7af10a</guid>
    <pubDate>Mon, 08 Oct 2007 01:22:11 +0000</pubDate>
    <dc:creator>Chty</dc:creator>
        <category>Software</category>
        <category>Apache2</category>    
    <description>    &lt;p&gt;Some time ago, I used &lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt; on my server. Everything went fine, except when &lt;a title=&quot;dotclear2&quot; href=&quot;http://dotclear.net&quot;&gt;dotclear2&lt;/a&gt; became needed. After some test, I concluded that it wont work with &lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt; given because of certain rewrite rules. This seems to be a known issue, and the only solution at the time of writing it to use &lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt; in its stead. Difference between &lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt; and &lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt; is mostly at license level. Although &lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt; is somewhat non-free, and after some troubles with the configuration, I decided to give it a try ;-)&lt;sup&gt;[&lt;a href=&quot;http://blog.chty.org/post/2007/10/08/#pnote-151-1&quot; id=&quot;rev-pnote-151-1&quot;&gt;1&lt;/a&gt;]&lt;/sup&gt;&lt;/p&gt;

&lt;p&gt;After configuring two vhosts, one with &lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt; and one with &lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt;, I benchmarked a simple &quot;Hello world&quot; program on &lt;a title=&quot;Apache&quot; href=&quot;http://www.apache.org/&quot;&gt;Apache2&lt;/a&gt;. Results are speaking by themselves:&lt;/p&gt;

&lt;ul&gt;
 &lt;li&gt;&lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt; benchmark test:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;
Server Software:        Apache/2.2.3
Server Hostname:        xxx
Server Port:            80

Document Path:          /
Document Length:        11 bytes

Concurrency Level:      5
Time taken for tests:   48.867314 seconds
Complete requests:      10000
Failed requests:        13
  (Connect: 0, Length: 13, Exceptions: 0)
Write errors:           0
Non-2xx responses:      13
Total transferred:      2959503 bytes
HTML transferred:       119256 bytes
Requests per second:    204.64 [#/sec] (mean)
Time per request:       24.434 [ms] (mean)
Time per request:       4.887 [ms] (mean, across all concurrent requests)
Transfer rate:          59.14 [Kbytes/sec] received

Connection Times (ms)
             min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1   23 360.7      1   12064
Waiting:        1   23 360.7      1   12064
Total:          1   23 360.7      1   12064

Percentage of the requests served within a certain time (ms)
 50%      1
 66%      1
 75%      1
 80%      1
 90%      1
 95%      1
 98%     17
 99%     21
 100%  12064 (longest request)
&lt;/pre&gt;

&lt;ul&gt;
 &lt;li&gt;&lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt; benchmark test:&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;
Server Software:        Apache/2.2.3
Server Hostname:        xxx
Server Port:            80

Document Path:          /
Document Length:        11 bytes

Concurrency Level:      5
Time taken for tests:   18.150717 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      2950000 bytes
HTML transferred:       110000 bytes
Requests per second:    550.94 [#/sec] (mean)
Time per request:       9.075 [ms] (mean)
Time per request:       1.815 [ms] (mean, across all concurrent requests)
Transfer rate:          158.67 [Kbytes/sec] received

Connection Times (ms)
             min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    8 194.4      2   11504
Waiting:        1    8 194.4      2   11504
Total:          1    8 194.4      2   11504

Percentage of the requests served within a certain time (ms)
 50%      2
 66%      3
 75%      3
 80%      3
 90%      4
 95%     12
 98%     17
 99%     20
 100%  11504 (longest request)
&lt;/pre&gt;

&lt;p&gt;I do not know if I'm doing wrong with &lt;a title=&quot;mod_fcgid&quot; href=&quot;http://fastcgi.coremail.cn/&quot;&gt;mod_fcgid&lt;/a&gt;, but the fact is that &lt;a title=&quot;mod_fastcgi&quot; href=&quot;http://fastcgi.com/&quot;&gt;mod_fastcgi&lt;/a&gt; operates at 250 request/second faster. No need to say, dotclear2 is coming soon on this blog :-)&lt;/p&gt;

&lt;p&gt;[&lt;a href=&quot;http://blog.chty.org/post/2007/10/08/#rev-pnote-151-1&quot; id=&quot;pnote-151-1&quot;&gt;1&lt;/a&gt;] thank's &lt;a title=&quot;Pep&quot; href=&quot;http://callmepep.org&quot;&gt;Pep&lt;/a&gt; :-)&lt;/p&gt;</description>
    
    
    
      </item>
    
</channel>
</rss>