aboutsummaryrefslogtreecommitdiff
path: root/nginx.example.conf
blob: 757b614cb2521680b544c09972fd98d333d3ea1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
load_module modules/ngx_http_jwted_module.so;

#user html;
worker_processes  1;

error_log  /var/log/nginx/error.log;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include mime.types;

    auth_jwt_key 'WKaDRAk7hx4ZiY5zV3H6cnGCzloBgWbV2FC1poLfzLY=';
    auth_jwt_cache on;

    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;

        location = /auth {
            proxy_pass http://localhost:5000;
        }

        location = /logout {
            proxy_pass http://localhost:5000;
        }

        #access_log  logs/host.access.log  main;
        location = /login {
            root /var/lib/weblogin;
            try_files $uri.html =404;
        }

        location @login_redirect {
            return 302 /login;
        }

        location / {
	        auth_jwt $cookie_auth;
            error_page 401 = @login_redirect;
	        root /usr/share/nginx/html;
        }

    }

}