2018-03-02 15:44:00 +01:00
|
|
|
server {
|
|
|
|
listen 80;
|
2019-07-12 11:32:26 +02:00
|
|
|
server_name test1.%%nom_domaine_local test2.%%nom_domaine_local;
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443;
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate %%server_cert;
|
|
|
|
ssl_certificate_key %%server_key;
|
|
|
|
ssl_client_certificate /etc/ssl/certs/ca.crt;
|
|
|
|
access_log /var/log/nginx/test1-2-lemon-ldap.access-ssl.log;
|
2018-03-02 15:44:00 +01:00
|
|
|
|
2019-07-12 11:32:26 +02:00
|
|
|
server_name test1.%%nom_domaine_local test2.%%nom_domaine_local;
|
|
|
|
root /var/lib/lemonldap-ng/test/;
|
2018-03-02 15:44:00 +01:00
|
|
|
|
|
|
|
# Internal authentication request
|
|
|
|
location = /lmauth {
|
|
|
|
internal;
|
2019-07-12 11:03:25 +02:00
|
|
|
|
|
|
|
# FastCGI configuration
|
2018-03-02 15:44:00 +01:00
|
|
|
include /etc/nginx/fastcgi_params;
|
|
|
|
fastcgi_pass unix:/var/run/llng-fastcgi-server/llng-fastcgi.sock;
|
|
|
|
# Drop post datas
|
|
|
|
fastcgi_pass_request_body off;
|
|
|
|
fastcgi_param CONTENT_LENGTH "";
|
|
|
|
# Keep original hostname
|
|
|
|
fastcgi_param HOST $http_host;
|
2019-07-12 11:03:25 +02:00
|
|
|
# Keep original request (LLNG server will receive /lmauth)
|
2018-03-02 15:44:00 +01:00
|
|
|
fastcgi_param X_ORIGINAL_URI $request_uri;
|
2019-07-12 11:03:25 +02:00
|
|
|
# Improve performances
|
|
|
|
#fastcgi_buffer_size 32k;
|
|
|
|
#fastcgi_buffers 32 32k;
|
|
|
|
|
2018-03-02 15:44:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Client requests
|
|
|
|
location / {
|
|
|
|
# Local application
|
|
|
|
index index.pl;
|
|
|
|
try_files $uri $uri/ =404;
|
|
|
|
|
|
|
|
# Reverse proxy
|
|
|
|
#proxy_pass http://remote.server/;
|
|
|
|
#include /etc/nginx/proxy_params;
|
|
|
|
|
|
|
|
##################################
|
|
|
|
# CALLING AUTHENTICATION #
|
|
|
|
##################################
|
|
|
|
auth_request /lmauth;
|
|
|
|
auth_request_set $lmremote_user $upstream_http_lm_remote_user;
|
|
|
|
auth_request_set $lmlocation $upstream_http_location;
|
2019-07-12 11:03:25 +02:00
|
|
|
# If CDA is used, uncomment this
|
2018-03-02 15:44:00 +01:00
|
|
|
#auth_request_set $cookie_value $upstream_http_set_cookie;
|
|
|
|
#add_header Set-Cookie $cookie_value;
|
|
|
|
# Remove this for AuthBasic handler
|
|
|
|
error_page 401 $lmlocation;
|
|
|
|
|
|
|
|
##################################
|
|
|
|
# PASSING HEADERS TO APPLICATION #
|
|
|
|
##################################
|
|
|
|
|
|
|
|
# IF LUA IS SUPPORTED
|
|
|
|
#include /etc/lemonldap-ng/nginx-lua-headers.conf;
|
|
|
|
|
|
|
|
# ELSE
|
|
|
|
# Set manually your headers
|
|
|
|
#auth_request_set $authuser $upstream_http_auth_user;
|
|
|
|
#proxy_set_header Auth-User $authuser;
|
2019-07-12 11:03:25 +02:00
|
|
|
# OR in the corresponding block
|
2018-03-02 15:44:00 +01:00
|
|
|
#fastcgi_param HTTP_AUTH_USER $authuser;
|
|
|
|
|
2019-07-12 11:03:25 +02:00
|
|
|
# Then (if LUA is not supported), change cookie header to hide LLNG cookie
|
2018-03-02 15:44:00 +01:00
|
|
|
#auth_request_set $lmcookie $upstream_http_cookie;
|
|
|
|
#proxy_set_header Cookie: $lmcookie;
|
|
|
|
# OR in the corresponding block
|
|
|
|
#fastcgi_param HTTP_COOKIE $lmcookie;
|
|
|
|
|
|
|
|
# Uncomment this if you use https only
|
2019-07-12 11:03:25 +02:00
|
|
|
#add_header Strict-Transport-Security "max-age=15768000";
|
2018-03-02 15:44:00 +01:00
|
|
|
|
|
|
|
# Set REMOTE_USER (for FastCGI apps only)
|
|
|
|
#fastcgi_param REMOTE_USER $lmremote_user;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Handle test CGI
|
2019-07-12 11:03:25 +02:00
|
|
|
location ~ ^(?<sc>/.*\.pl)(?:$|/) {
|
2018-03-02 15:44:00 +01:00
|
|
|
include /etc/nginx/fastcgi_params;
|
|
|
|
fastcgi_pass unix:/var/run/llng-fastcgi-server/llng-fastcgi.sock;
|
|
|
|
fastcgi_param LLTYPE cgi;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
fastcgi_split_path_info ^(.*\.pl)(/.+)$;
|
|
|
|
fastcgi_param REMOTE_USER $lmremote_user;
|
2019-07-12 11:03:25 +02:00
|
|
|
|
|
|
|
# Or with uWSGI
|
|
|
|
#include /etc/nginx/uwsgi_params;
|
|
|
|
#uwsgi_pass 127.0.0.1:5000;
|
|
|
|
#uwsgi_param LLTYPE cgi;
|
|
|
|
#uwsgi_param SCRIPT_FILENAME $document_root$sc;
|
|
|
|
#uwsgi_param SCRIPT_NAME $sc;
|
2018-03-02 15:44:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#location = /status {
|
|
|
|
# allow 127.0.0.1;
|
|
|
|
# deny all;
|
|
|
|
# include /etc/nginx/fastcgi_params;
|
|
|
|
# fastcgi_pass unix:/var/run/llng-fastcgi-server/llng-fastcgi.sock;
|
|
|
|
# fastcgi_param LLTYPE status;
|
2019-07-12 11:03:25 +02:00
|
|
|
|
|
|
|
### Or with uWSGI
|
|
|
|
## include /etc/nginx/uwsgi_params;
|
|
|
|
## uwsgi_pass 127.0.0.1:5000;
|
|
|
|
## uwsgi_param LLTYPE status;
|
2018-03-02 15:44:00 +01:00
|
|
|
#}
|
|
|
|
}
|