First Nginx configuration that runs !!!

To see it, launch 'make e2e_tests TESTWEBSERVER=nginx'
This commit is contained in:
Xavier Guimard 2016-01-29 16:50:16 +00:00
parent 84ee77100b
commit a001fb1be4
7 changed files with 90 additions and 12 deletions

View File

@ -323,7 +323,7 @@ start_web_server: all prepare_test_server
elif test "$(TESTWEBSERVER)" = "nginx"; then \
echo "Launching nginx"; \
$(NGINX) -p `pwd`/e2e-tests \
-g 'error_log /home/xavier/dev/lemonldap/e2e-tests/conf/nginx.log;' \
-g 'error_log '`pwd`'/e2e-tests/conf/nginx.log;' \
-c `pwd`/e2e-tests/nginx.conf \
2>&1 | grep -v 'Permission denied' || true; \
echo "Launching plackup"; \
@ -370,7 +370,7 @@ plackup:
--exec /usr/bin/plackup -- \
-s FCGI \
--listen e2e-tests/conf/llng.sock \
e2e-tests/handler-server.psgi
e2e-tests/llng.psgi
#
# INSTALL
@ -477,7 +477,7 @@ install_webserver_conf:
cp -f _example/etc/handler-apache$(APACHEVERSION).conf $(RCONFDIR); \
cp -f _example/etc/manager-apache$(APACHEVERSION).conf $(RCONFDIR); \
cp -f _example/etc/test-apache$(APACHEVERSION).conf $(RCONFDIR); \
cp -f _example/etc/handler-nginx.conf $(RCONFDIR); \
cp -f _example/etc/*-nginx.conf $(RCONFDIR); \
fi
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g; \
s#__PORTALDIR__#$(PORTALDIR)/#g; \

View File

@ -1,6 +1,6 @@
server {
listen __PORT__;
server_name test1.example.com;
server_name test1.__DNSDOMAIN__;
root /var/www/html;

View File

@ -0,0 +1,21 @@
server {
listen __PORT__;
server_name manager.__DNSDOMAIN__;
root __MANAGERDIR__;
rewrite ^/$ /manager.psgi last;
if ($uri !~ ^/(static|doc|fr-doc|lib)) {
rewrite ^/(.*)$ /manager.psgi/$1 break;
}
location /manager.psgi {
include /etc/nginx/fastcgi_params;
fastcgi_pass __PSGISERVERSOCKET__;
fastcgi_param LLTYPE manager;
fastcgi_param SCRIPT_NAME /manager.psgi;
}
location / {
try_files $uri $uri/ =404;
}
}

View File

@ -0,0 +1,18 @@
server {
listen __PORT__;
server_name auth.__DNSDOMAIN__;
root __PORTALDIR__;
rewrite ^/$ /auth.psgi last;
location /auth.psgi {
include /etc/nginx/fastcgi_params;
fastcgi_pass __PSGISERVERSOCKET__;
fastcgi_param LLTYPE auth;
fastcgi_param SCRIPT_NAME /manager.psgi;
}
location / {
try_files $uri $uri/ =404;
}
}

View File

@ -1,8 +0,0 @@
#!/usr/bin/env plackup
use lib 'lemonldap-ng-common/blib/lib';
use lib 'lemonldap-ng-handler/blib/lib';
use Lemonldap::NG::Handler::PSGI::Server;
Lemonldap::NG::Handler::PSGI::Server->run({});

46
e2e-tests/llng.psgi Normal file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env perl
use warnings;
BEGIN {
$pwd = `pwd`;
chomp $pwd;
eval qq{
use lib "$pwd/lemonldap-ng-common/blib/lib";
use lib "$pwd/lemonldap-ng-handler/blib/lib";
use lib "$pwd/lemonldap-ng-portal/blib/lib";
use lib "$pwd/lemonldap-ng-manager/blib/lib";
};
die $@ if ($@);
}
my %_apps;
my %builder = (
handler => sub {
require Lemonldap::NG::Handler::PSGI::Server;
return Lemonldap::NG::Handler::PSGI::Server->run( {} );
},
manager => sub {
require Lemonldap::NG::Manager;
return Lemonldap::NG::Manager->run( {} );
},
auth => sub {
require CGI::Emulate::PSGI;
require CGI::Compile;
return CGI::Emulate::PSGI->handler(
CGI::Compile->compile('lemonldap-ng-portal/example/index.pl') );
}
);
sub {
my $type = $_[0]->{LLTYPE} || 'handler';
print STDERR Dumper($_[0]);use Data::Dumper;
return $_apps{$type}->(@_) if ( defined $_apps{$type} );
if ( defined $builder{$type} ) {
$_apps{$type} = $builder{$type}->();
return $_apps{$type}->(@_);
}
die "Unknown PSGI type $type";
};

View File

@ -8,6 +8,7 @@ events {
http {
sendfile on;
client_body_temp_path conf/;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;