lemonldap-ng/_example/etc/test-nginx.conf

131 lines
4.0 KiB
Plaintext
Raw Normal View History

2016-02-02 07:23:27 +01:00
server {
listen __PORT__;
listen [::]:__PORT__;
2016-02-16 17:01:32 +01:00
server_name test1.__DNSDOMAIN__ test2.__DNSDOMAIN__;
root __TESTDIR__;
2016-02-02 07:23:27 +01:00
# Uncomment this if you are running behind a reverse proxy and want
# LemonLDAP::NG to see the real IP address of the end user
# Adjust the settings to match the IP address of your reverse proxy
# and the header containing the original IP address
# As an alternative, you can use the PROXY protocol
#
#set_real_ip_from 127.0.0.1;
#real_ip_header X-Forwarded-For;
2016-02-02 07:23:27 +01:00
# Internal authentication request
location = /lmauth {
internal;
2018-03-22 21:52:00 +01:00
# FastCGI configuration
2018-07-11 21:51:47 +02:00
include /etc/nginx/fastcgi_params;
2018-03-22 21:52:00 +01:00
fastcgi_pass unix:__FASTCGISOCKDIR__/llng-fastcgi.sock;
2016-02-02 07:23:27 +01:00
# Drop post datas
fastcgi_pass_request_body off;
fastcgi_param CONTENT_LENGTH "";
# Keep original hostname
fastcgi_param HOST $http_host;
2018-06-08 23:48:36 +02:00
# Keep original request (LLNG server will receive /lmauth)
fastcgi_param X_ORIGINAL_URI $original_uri;
2019-04-05 11:38:51 +02:00
# Improve performances
#fastcgi_buffer_size 32k;
#fastcgi_buffers 32 32k;
2018-03-22 21:52:00 +01:00
2022-10-23 21:15:24 +02:00
# Or with uWSGI
2018-03-22 21:52:00 +01:00
#include /etc/nginx/uwsgi_params;
#uwsgi_pass 127.0.0.1:5000;
2022-10-23 21:15:24 +02:00
# Drop post datas
2018-03-22 21:52:00 +01:00
#uwsgi_pass_request_body off;
#uwsgi_param CONTENT_LENGTH "";
2022-10-23 21:15:24 +02:00
# Keep original hostname
2018-03-22 21:52:00 +01:00
#uwsgi_param HOST $http_host;
2022-10-23 21:15:24 +02:00
# Keep original request (LLNG server will receive /lmauth)
#uwsgi_param X_ORIGINAL_URI $original_uri;
2022-10-23 21:15:24 +02:00
## Improve performances
2019-04-05 11:38:51 +02:00
#uwsgi_buffer_size 32k;
#uwsgi_buffers 32 32k;
2016-02-02 07:23:27 +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 #
##################################
set $original_uri $uri$is_args$args;
2016-02-02 07:23:27 +01:00
auth_request /lmauth;
auth_request_set $lmremote_user $upstream_http_lm_remote_user;
2019-08-20 23:43:04 +02:00
auth_request_set $lmremote_custom $upstream_http_lm_remote_custom;
2016-02-02 07:23:27 +01:00
auth_request_set $lmlocation $upstream_http_location;
2017-03-21 12:04:35 +01:00
# If CDA is used, uncomment this
#auth_request_set $cookie_value $upstream_http_set_cookie;
#add_header Set-Cookie $cookie_value;
# Remove this for AuthBasic and OAuth2 handlers
2016-02-02 07:23:27 +01:00
error_page 401 $lmlocation;
2016-02-16 17:01:32 +01:00
##################################
# PASSING HEADERS TO APPLICATION #
##################################
2016-02-02 07:23:27 +01:00
# IF LUA IS SUPPORTED
2016-02-24 07:54:18 +01:00
#include __CONFDIR__/nginx-lua-headers.conf;
2016-02-02 07:23:27 +01:00
# ELSE
# Set manually your headers
#auth_request_set $authuser $upstream_http_auth_user;
#proxy_set_header Auth-User $authuser;
2019-01-30 19:31:25 +01:00
# OR in the corresponding block
#fastcgi_param HTTP_AUTH_USER $authuser;
2016-02-02 07:23:27 +01:00
2019-01-30 19:31:25 +01:00
# Then (if LUA is not supported), change cookie header to hide LLNG cookie
2016-02-25 10:09:07 +01:00
#auth_request_set $lmcookie $upstream_http_cookie;
#proxy_set_header Cookie: $lmcookie;
# OR in the corresponding block
2016-02-25 10:09:07 +01:00
#fastcgi_param HTTP_COOKIE $lmcookie;
2019-08-16 15:22:06 +02:00
# Set REMOTE_USER and REMOTE_CUSTOM (for FastCGI apps only)
#fastcgi_param REMOTE_USER $lmremote_user;
2019-08-16 15:22:06 +02:00
#fastcgi_param REMOTE_CUSTOM $lmremote_custom;
}
# Handle test CGI
2018-03-27 21:50:22 +02:00
location ~ ^(?<sc>/.*\.pl)(?:$|/) {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:__FASTCGISOCKDIR__/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-08-16 15:22:06 +02:00
fastcgi_param REMOTE_CUSTOM $lmremote_custom;
2018-03-27 21:50:22 +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;
2016-02-02 07:23:27 +01:00
}
2016-02-18 13:23:55 +01:00
#location = /status {
# allow 127.0.0.1/8;
# allow ::1/128;
# deny all;
# include /etc/nginx/fastcgi_params;
2016-02-15 19:15:43 +01:00
# fastcgi_pass unix:__FASTCGISOCKDIR__/llng-fastcgi.sock;
# fastcgi_param LLTYPE status;
2018-07-11 21:51:47 +02:00
### Or with uWSGI
## include /etc/nginx/uwsgi_params;
## uwsgi_pass 127.0.0.1:5000;
## uwsgi_param LLTYPE status;
#}
2016-02-02 07:23:27 +01:00
}