WebDAO

 view release on metacpan or  search on metacpan

contrib/Setup.ru.pod  view on Meta::CPAN

Возможны два режима. Когда используется собственный менеджер I<FCGI>( I<FastCgiServer> ) и
кода подключение производится через FCGI сокет.

Требуется установка модуля I<mod_fastcgi>:

        mod_fastcgi-2.4.2

В глобальной части C<httpd.conf> требуется добавить одну из необходимых секций:

=item 1 Static (FastCgiServer)

     <LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
        <IfModule mod_fastcgi.c>
        AddHandler fastcgi-script fpl fcgi
        FastCgiServer /usr/local/bin/wd_fcgi.fpl \
            -idle-timeout 3000 -flush -restart-delay 5 \
            -initial-env wdFCGIreq=1000 -processes 4 \
    </IfModule>

=item 2 Standalone ( FastCgiExternalServer )

     <LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so
      <IfModule mod_fastcgi.c>
      # Connect via net socket
      # FastCgiExternalServer /usr/local/bin/wd_fcgi.fpl -host localhost:60000
       FastCgiExternalServer /usr/local/bin/wd_fcgi.fpl -socket /tmp/myapp.socket
      </IfModule>

Настройки секции B<VirtualHost>:

 <VirtualHost>
    DocumentRoot /usr/zag/www
    ServerName example.org
    ErrorLog /var/log/example.org-error_log
    CustomLog /var/log/example.org-access_log common
    SetEnv wdEngine WedDAO::Kern
    SetEnv wdIndexFile index.xhtml
    SetEnv wdSession WebDAO::Sessionco

    RewriteEngine on
    AddDefaultCharset UTF-8
    RewriteCond     %{HTTP:Authorization}   ^(.*)$ [NC]
    RewriteRule     /.*             -       [E=HTTP_AUTHORIZATION:%1]
    <IfModule mod_fastcgi.c>
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        RewriteRule ^/(.*) /usr/local/bin/wd_fcgi.fpl?$1 [QSA]
    </IfModule>
 </VirtualHost>



=head4 lighttpd (standalone FastCGI)

    var.engine = "ZagSite"
    var.defaults = (
        "WD_SESSION"=>"WebDAO::Sessionco",
        "WD_INDEXFILE"=>"index.xhtm"
    )
    $HTTP["host"] == "example.org" {
    server.document-root    = "/home/zag/www/"
    setenv.add-environment =  var.defaults 
    }
    #use custom root class - MySite
    $HTTP["host"] == "example.com" {
    server.document-root    = "/home/zag/www/"
    setenv.add-environment =  var.defaults + (  
        "WD_ENGINE" => "MySite",
        "WD_ENGINE_PAR"=>"config=/home/zag/www/mysite.ini" 
        )
    }
    #skip static 
    $HTTP["url"] !~ "^/(js|imag|img|css|static)" {
       fastcgi.server = (
        "" => (
            "" => (
                "socket"      => "/tmp/webdao.sock",
                "check-local" => "disable"
                    )
                )
            )

    }


=head3 Настройка cgi сервера 

Для работы I<WebDAO> как  I<CGI> приложения используется скрипт I<wd_cgi.pl>.


=head4 apache ( CGI )

 <VirtualHost *>
    DocumentRoot /usr/zag/www
    ServerName example.org
    ErrorLog /var/log/example.org-error_log
    CustomLog /var/log/example.org-access_log common
    
    SetEnv wdIndexFile index.xhtm
    SetEnv wdEngine WebDAO::Engine
    SetEnv wdSession WebDAO::Sessionco
    
    RewriteEngine on
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*) /usr/local/bin/wd_cgi.pl?$1 [QSA]
    <Directory "/usr/local/bin/wd_cgi.pl">
      AddHandler cgi-script cgi pl
      Options Indexes FollowSymLinks ExecCGI
    </Directory>
 </VirtualHost>

=head4 Запуск из I<shell>

Для запуска из командной строки используется скрипт I<wd_shell.pl>. В процессе выполнения используются переменные окружения.

  Usage:
      wd_shell.pl [options] file.pl

       options:

        -help  - print help message
        -man   - print man page
        -f file    - set root [x]html file 
  
  Options:

    -help   Print a brief help message and exits



( run in 0.954 second using v1.01-cache-2.11-cpan-39bf76dae61 )