Enable new portal with Nginx (#595)
This commit is contained in:
parent
f6d85f507b
commit
44de078234
8
Makefile
8
Makefile
|
@ -385,7 +385,7 @@ prepare_test_server:
|
|||
SBINDIR=`pwd`/e2e-tests/conf/sbin \
|
||||
INITDIR=`pwd`/e2e-tests/conf/init \
|
||||
ETCDEFAULTDIR=`pwd`/e2e-tests/conf/def
|
||||
@cp -f e2e-tests/index.fcgi e2e-tests/conf/index.fcgi
|
||||
@cp -f e2e-tests/index.* e2e-tests/conf/
|
||||
@cp e2e-tests/lmConf-1.js e2e-tests/lemonldap-ng.ini e2e-tests/env.conf e2e-tests/test-nginx.conf e2e-tests/conf/
|
||||
@cp e2e-tests/form.html e2e-tests/conf/site
|
||||
@perl -i -pe 'BEGIN{$$p=`pwd`;chomp $$p}s#__pwd__#$$p#;s#__port__#$(TESTWEBSERVERPORT)#;s#__FASTCGISOCKDIR__#$(FASTCGISOCKDIR)#;' \
|
||||
|
@ -626,15 +626,15 @@ install_manager_site: install_conf_dir
|
|||
# Clean svn files
|
||||
@rm -rf $$(find ${RMANAGERSTATICDIR} $(RMANAGERPSGIDIR) \
|
||||
$(RMANAGERTEMPLATESDIR) $(RCONFDIR) -type d -name .svn)
|
||||
$(PERL) -i -pe 's#__MANAGERSTATICDIR__#$(MANAGERRELATIVESTATICDIR)#g' $(RCONFDIR)/$(CONFFILENAME)
|
||||
$(PERL) -i -pe 's#__MANAGERTEMPLATESDIR__#$(MANAGERTEMPLATESDIR)#g' $(RCONFDIR)/$(CONFFILENAME)
|
||||
@$(PERL) -i -pe 's#__MANAGERSTATICDIR__#$(MANAGERRELATIVESTATICDIR)#g' $(RCONFDIR)/$(CONFFILENAME)
|
||||
@$(PERL) -i -pe 's#__MANAGERTEMPLATESDIR__#$(MANAGERTEMPLATESDIR)#g' $(RCONFDIR)/$(CONFFILENAME)
|
||||
|
||||
install_portal_site: install_conf_dir
|
||||
# Portal install
|
||||
@install -v -d $(RPORTALDIR) $(RPORTALSTATICDIR) \
|
||||
$(RPORTALDIR)/skins/ \
|
||||
$(RCRONDIR) $(RCONFDIR)
|
||||
@cp -pR -f $(SRCPORTALDIR)/site/htdocs/index.fcgi $(RPORTALDIR)
|
||||
@cp -pR -f $(SRCPORTALDIR)/site/htdocs/index.* $(RPORTALDIR)
|
||||
@cp -pR -f $(SRCPORTALDIR)/site/htdocs/static/* $(RPORTALSTATICDIR)
|
||||
@tar -cf - -C ${SRCPORTALDIR}/site/templates/ $$(ls ${SRCPORTALDIR}/site/templates/) |tar -xf - -C $(RPORTALTEMPLATESDIR)
|
||||
@for f in `find $(RPORTALTEMPLATEDIR) -type f -name '*.tpl'`; do \
|
||||
|
|
|
@ -12,6 +12,8 @@ server {
|
|||
fastcgi_pass unix:__FASTCGISOCKDIR__/llng-fastcgi.sock;
|
||||
fastcgi_param LLTYPE manager;
|
||||
fastcgi_param SCRIPT_NAME /manager.psgi;
|
||||
fastcgi_split_path_info ^(.*\.psgi)(/.+)$;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
|
||||
location / {
|
||||
|
|
|
@ -10,13 +10,14 @@ server {
|
|||
location ~ \.psgi(?:$|/) {
|
||||
include /etc/nginx/fastcgi_params;
|
||||
fastcgi_pass unix:__FASTCGISOCKDIR__/llng-fastcgi.sock;
|
||||
fastcgi_param LLTYPE cgi;
|
||||
fastcgi_param LLTYPE psgi;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
set $sn $request_uri;
|
||||
if ($sn ~ "^(.*)\?") {
|
||||
set $sn $document_uri;
|
||||
if ($sn ~ "^(.*\.psgi).*") {
|
||||
set $sn $1;
|
||||
}
|
||||
fastcgi_param SCRIPT_NAME $sn;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$sn;
|
||||
fastcgi_split_path_info ^(.*\.psgi)(/.+)$;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
|
@ -29,6 +30,10 @@ server {
|
|||
#add_header Strict-Transport-Security "15768000";
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias __PORTALSTATICDIR__;
|
||||
}
|
||||
|
||||
# SOAP functions for sessions management (disabled by default)
|
||||
location /index/adminSessions {
|
||||
deny all;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
use Lemonldap::NG::Portal::Main;
|
||||
|
||||
Lemonldap::NG::Portal::Main->run( {} );
|
|
@ -1,5 +1,7 @@
|
|||
worker_processes auto;
|
||||
pid conf/nginx.pid;
|
||||
load_module /usr/lib/nginx/modules/ndk_http_module.so;
|
||||
load_module /usr/lib/nginx/modules/ngx_http_lua_module.so;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
|
@ -15,7 +17,7 @@ http {
|
|||
types_hash_max_size 2048;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
error_log conf/nginx.log info;
|
||||
error_log conf/nginx.log debug;
|
||||
gzip off;
|
||||
include conf/*nginx.conf;
|
||||
access_log conf/nginx.log lm_combined;
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "llng-fastcgi-server 1"
|
||||
.TH llng-fastcgi-server 1 "2017-01-05" "perl v5.24.1" "User Contributed Perl Documentation"
|
||||
.TH llng-fastcgi-server 1 "2017-01-09" "perl v5.24.1" "User Contributed Perl Documentation"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||
.\" way too many mistakes in technical documents.
|
||||
.if n .ad l
|
||||
|
|
|
@ -5,7 +5,7 @@ use strict;
|
|||
use warnings;
|
||||
use POSIX;
|
||||
use Getopt::Long;
|
||||
use Lemonldap::NG::Handler::SharedConf;
|
||||
use Lemonldap::NG::Handler::Main::Reload;
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
||||
|
@ -87,6 +87,14 @@ my %builder = (
|
|||
return $_apps{$script}->(@_);
|
||||
};
|
||||
},
|
||||
psgi => sub {
|
||||
return sub {
|
||||
my $script = $_[0]->{SCRIPT_FILENAME};
|
||||
return $_apps{$script}->(@_) if ( $_apps{$script} );
|
||||
$_apps{$script} = do $script;
|
||||
return $_apps{$script}->(@_);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
unless ($>) {
|
||||
|
@ -104,15 +112,30 @@ my $app = sub {
|
|||
};
|
||||
|
||||
# Hook for customFunctions initialization
|
||||
use Lemonldap::NG::Handler::API::PSGI::Server;
|
||||
$Lemonldap::NG::Handler::API::mode = 'PSGI::Server';
|
||||
Lemonldap::NG::Handler::SharedConf->init();
|
||||
Lemonldap::NG::Handler::Main::Reload->onReload(
|
||||
bless( {}, 'Lemonldap::NG::Handler::FastCGI::Loader' ),
|
||||
'loadCustomLogins' );
|
||||
|
||||
my $server = Plack::Runner->new();
|
||||
$server->parse_options(
|
||||
'-s' => $engine,
|
||||
'-E' => 'deployment',
|
||||
'--pid' => $pidFile,
|
||||
'--nproc' => $nproc,
|
||||
'--socket' => $socket,
|
||||
'--proc-title' => 'llng-fastcgi-server',
|
||||
( $foreground ? () : '--daemonize' ),
|
||||
'--no-default-middleware',
|
||||
%plackOptions,
|
||||
);
|
||||
|
||||
$server->run($app);
|
||||
|
||||
package Lemonldap::NG::Handler::FastCGI::Loader;
|
||||
|
||||
# Load configuration and look if custom handlers have been defined
|
||||
{
|
||||
$Lemonldap::NG::Handler::API::mode = 'PSGI::Server';
|
||||
my $conf = Lemonldap::NG::Handler::SharedConf->checkConf()
|
||||
or die "Unable to get configuration";
|
||||
sub loadCustomLogins {
|
||||
my ( $obj, $conf ) = @_;
|
||||
foreach my $lltype ( keys %{ $conf->{nginxCustomHandlers} // {} } ) {
|
||||
my $v = $conf->{nginxCustomHandlers}->{$lltype};
|
||||
if ( $v =~ m#[/\\\.]# ) {
|
||||
|
@ -131,21 +154,6 @@ Lemonldap::NG::Handler::SharedConf->init();
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
my $server = Plack::Runner->new();
|
||||
$server->parse_options(
|
||||
'-s' => $engine,
|
||||
'-E' => 'deployment',
|
||||
'--pid' => $pidFile,
|
||||
'--nproc' => $nproc,
|
||||
'--socket' => $socket,
|
||||
'--proc-title' => 'llng-fastcgi-server',
|
||||
( $foreground ? () : '--daemonize' ),
|
||||
'--no-default-middleware',
|
||||
%plackOptions,
|
||||
);
|
||||
|
||||
$server->run($app);
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
use Lemonldap::NG::Portal::Main;
|
||||
|
||||
Lemonldap::NG::Portal::Main->run({});
|
Loading…
Reference in New Issue