forked from ledgersmb/LedgerSMB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging fcgi support into main branches
git-svn-id: svn://svn.code.sf.net/p/ledger-smb/code/branches/1.3@5305 4979c152-3d1c-0410-bac9-87ea11338e46
- Loading branch information
Showing
6 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/plackup -s FCGI ledgersmb.fcgi | ||
|
||
package LedgerSMB::FCGI; | ||
|
||
use CGI::Emulate::PSGI; | ||
use FCGI::ProcManager; | ||
use FindBin; | ||
# Preloads | ||
use LedgerSMB; | ||
use LedgerSMB::Form; | ||
use LedgerSMB::Sysconfig; | ||
use LedgerSMB::Template; | ||
use LedgerSMB::Template::LaTeX; | ||
use LedgerSMB::Template::HTML; | ||
use LedgerSMB::Locale; | ||
use LedgerSMB::DBObject; | ||
use LedgerSMB::File; | ||
|
||
BEGIN { | ||
lib->import($FindBin::Bin) unless $ENV{mod_perl} | ||
} | ||
|
||
# Process Manager | ||
my $proc_manager = FCGI::ProcManager->new({ n_processes => 10 }); | ||
|
||
|
||
my $app = CGI::Emulate::PSGI->handler( | ||
sub { | ||
if (my $cpid = fork()){ | ||
wait | ||
} else { | ||
$proc_manager->pm_pre_dispatch(); | ||
$uri = $ENV{REQUEST_URI}; | ||
$uri =~ s/\?.*//; | ||
$ENV{SCRIPT_NAME} = $uri; | ||
$ENV{SCRIPT_NAME} =~ m/([^\/\\]*.pl)\?*.*$/; | ||
|
||
my $script = $1; | ||
warn $script; | ||
do "./$script"; | ||
$proc_manager->pm_post_dispatch(); | ||
} | ||
} | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# This file must be edited to substitute the current path with WORKING_DIR | ||
|
||
Alias /ledgersmb_1.3 WORKING_DIR/ | ||
LoadModule fastcgi_module modules/mod_fastcgi.so | ||
|
||
LogLevel debug | ||
|
||
FastCgiExternalServer WORKING_DIR/ledgersmb.fcgi -socket /var/run/httpd/fastcgi/lsmb.sock -idle-timeout 240 -pass-header Authorization | ||
|
||
<Directory WORKING_DIR> | ||
|
||
# Rewrite rule to allow HTTP Authorization information to the scripts only | ||
# from this directory. | ||
RewriteEngine On | ||
RewriteBase /ledgersmb_1.3/ | ||
RewriteRule ^([^/]*\.pl) ledgersmb.fcgi/$0 | ||
|
||
|
||
AllowOverride All | ||
Options Includes FollowSymlinks +ExecCGI | ||
|
||
|
||
# By default, only allow from localhost. If you change this, please be | ||
# advised that you should use SSL protection on any and all network | ||
# connections that access this application in order to protect usernames and | ||
# passwords. | ||
|
||
# The rest of this file just tightens up security. | ||
<Files ~ "\.conf$"> | ||
Order Deny,Allow | ||
Deny from All | ||
</Files> | ||
</Directory> | ||
|
||
<Directory WORKING_DIR/users> | ||
Order Deny,Allow | ||
Deny from All | ||
</Directory> | ||
|
||
<Directory WORKING_DIR/bin> | ||
Order Deny,Allow | ||
Deny from All | ||
</Directory> | ||
|
||
<Directory WORKING_DIR/utils> | ||
Order Deny,Allow | ||
Deny from All | ||
</Directory> | ||
|
||
<Directory WORKING_DIR/spool> | ||
Order Deny,Allow | ||
Deny from All | ||
</Directory> | ||
|
||
<Directory WORKING_DIR/templates> | ||
Order Deny,Allow | ||
Deny from All | ||
</Directory> | ||
|
||
<Directory WORKING_DIR/LedgerSMB> | ||
Order Deny,Allow | ||
Deny from All | ||
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[Unit] | ||
Description=LedgerSMB FCGI service | ||
After=syslog.target | ||
|
||
[Service] | ||
Type=forkking | ||
PIDfile=/var/run/httpd/lsmb.pid | ||
RemainAfterExit=yes | ||
ExecStart=/usr/bin/lsmbstart | ||
ExecStop=/usr/bin/lsmbstop | ||
Environment=BOOTUP=serial | ||
Environment=CONSOLETYPE=serial | ||
StandardOutput=syslog | ||
StandardError=syslog | ||
|
||
[Install] | ||
WantedBy=basic.target | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/bash | ||
|
||
cd /usr/share/ledgersmb | ||
plackup -s FCGI -D --listen /var/run/httpd/fastcgi/lsmb.sock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/bash | ||
|
||
killall perl-fcgi-pm | ||
|