lemonldap-ng/doc/pages/documentation/current/highperfnginxhandler.html
2018-04-17 10:33:26 +02:00

131 lines
6.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>documentation:2.0:highperfnginxhandler</title>
<meta name="generator" content="DokuWiki"/>
<meta name="robots" content="index,follow"/>
<meta name="keywords" content="documentation,2.0,highperfnginxhandler"/>
<link rel="search" type="application/opensearchdescription+xml" href="lib/exe/opensearch.html" title="LemonLDAP::NG"/>
<link rel="start" href="highperfnginxhandler.html"/>
<link rel="contents" href="highperfnginxhandler.html" title="Sitemap"/>
<link rel="stylesheet" type="text/css" href="lib/exe/css.php.t.bootstrap3.css"/>
<!-- //if:usedebianlibs
<link rel="stylesheet" type="text/css" href="/javascript/bootstrap/css/bootstrap.min.css" />
//elsif:useexternallibs
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"></script>
//elsif:cssminified
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.min.css" />
//else -->
<link rel="stylesheet" type="text/css" href="/static/bwr/bootstrap/dist/css/bootstrap.css" />
<!-- //endif -->
<script type="text/javascript">/*<![CDATA[*/var NS='documentation:2.0';var JSINFO = {"id":"documentation:2.0:highperfnginxhandler","namespace":"documentation:2.0"};
/*!]]>*/</script>
<script type="text/javascript" charset="utf-8" src="lib/exe/js.php.t.bootstrap3.js"></script>
<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery/jquery.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery/dist/jquery.js"></script>
<!-- //endif -->
<!-- //if:usedebianlibs
<script type="text/javascript" src="/javascript/jquery-ui/jquery-ui.min.js"></script>
//elsif:useexternallibs
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
//elsif:jsminified
<script type="text/javascript" src="/static/bwr/jquery-ui/jquery-ui.min.js"></script>
//else -->
<script type="text/javascript" src="/static/bwr/jquery-ui/jquery-ui.js"></script>
<!-- //endif -->
</head>
<body>
<div class="dokuwiki export container">
<h1 class="sectionedit1" id="high_performance_handler_for_nginx">High performance handler for Nginx</h1>
<div class="level1">
<p>
By default, LLNG-FastCGI-Server provides a FastCGI server that handles all LLNG services using a FastCGI socket.
</p>
<p>
To increase handler performances, It can be replaced by any Plack family server using for examle this simple app:
</p>
<dl class="file">
<dt><a href="_export/code/documentation/2.0/highperfnginxhandler/codeblock.0.code" title="Download Snippet" class="mediafile mf_psgi">app.psgi</a></dt>
<dd><pre class="code file perl"><a href="http://perldoc.perl.org/functions/require.html"><span class="kw3">require</span></a> Lemonldap<span class="sy0">::</span><span class="me2">NG</span><span class="sy0">::</span><span class="me2">Handler</span><span class="sy0">::</span><span class="me2">Server</span><span class="sy0">::</span><span class="me2">Nginx</span><span class="sy0">;</span>
Lemonldap<span class="sy0">::</span><span class="me2">NG</span><span class="sy0">::</span><span class="me2">Handler</span><span class="sy0">::</span><span class="me2">Server</span><span class="sy0">::</span><span class="me2">Nginx</span><span class="sy0">-&gt;</span><span class="me1">run</span><span class="br0">&#40;</span> <span class="br0">&#123;</span><span class="br0">&#125;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre>
</dd></dl>
<p>
Example to launch it:
</p>
<ul>
<li class="level1"><div class="li"> <a href="http://uwsgi-docs.readthedocs.io/en/latest/Perl.html" class="urlextern" title="http://uwsgi-docs.readthedocs.io/en/latest/Perl.html" rel="nofollow">uWSGI</a> <em>(probably the fastest)</em>: <strong>see below</strong></div>
</li>
<li class="level1"><div class="li"> <a href="https://metacpan.org/pod/distribution/Starman/script/starman" class="urlextern" title="https://metacpan.org/pod/distribution/Starman/script/starman" rel="nofollow">Starman</a> <em>(“Prefork” server)</em>: <code>plackup -s Starman listen 127.0.0.1:9090 app.psgi</code></div>
</li>
<li class="level1"><div class="li"> <a href="https://metacpan.org/pod/twiggy" class="urlextern" title="https://metacpan.org/pod/twiggy" rel="nofollow">Twiggy</a> <em>(“Event” server)</em>: <code>plackup -s Twiggy listen 127.0.0.1:9090 app.psgi</code></div>
</li>
<li class="level1"><div class="li"> <a href="https://metacpan.org/pod/Twiggy::Prefork" class="urlextern" title="https://metacpan.org/pod/Twiggy::Prefork" rel="nofollow">Twiggy::Prefork</a> <em>(“Event+Prefork” server)</em>: <code>plackup -s Twiggy::Prefork listen 127.0.0.1:9090 app.psgi</code></div>
</li>
</ul>
<p>
You must so remplace <code>lmauth</code> configuration in Nginx configuration file:
</p>
<pre class="code file nginx"> location = /lmauth {
internal;
proxy_pass http://127.0.0.1:9090/;
&nbsp;
# Drop post datas
proxy_pass_request_body off;
proxy_set_header Content-Length &quot;&quot;;
&nbsp;
# Keep original hostname
proxy_set_header Host $http_host;
&nbsp;
# Keep original request (LLNG server will received /llauth)
proxy_set_header X-Original_Uri $request_uri;
}
...</pre>
</div>
<!-- EDIT1 SECTION "High performance handler for Nginx" [1-1440] -->
<h2 class="sectionedit2" id="using_uwsgi">Using uWSGI</h2>
<div class="level2">
<p>
This configuration requires uWSGI, uWSGI PSGI plugin and Nginx uwsgi module.
</p>
<pre class="code bash"><span class="co4">$ </span>uwsgi <span class="re5">--plugins</span> psgi <span class="re5">--socket</span> :<span class="nu0">5000</span> <span class="re5">--psgi</span> llng-server.psgi</pre>
<p>
Nginx configuration:
</p>
<pre class="code file nginx">upstream uwsgi-test {
server 127.0.0.1:5000;
}
&nbsp;
server {
location = /lmauth {
internal;
include uwsgi_params;
uwsgi_pass_request_body off;
uwsgi_param CONTENT_LENGTH &quot;&quot;;
uwsgi_param HOST $http_host;
uwsgi_param X_ORIGINAL_URI $request_uri;
uwsgi_modifier1 5;
uwsgi_pass uwsgi-test;
}
...
}</pre>
</div>
<!-- EDIT2 SECTION "Using uWSGI" [1441-] --></div>
</body>
</html>