-
Notifications
You must be signed in to change notification settings - Fork 4
/
nginx.conf
110 lines (95 loc) · 4.09 KB
/
nginx.conf
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
user www-data;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
# You may wish to change this if you have memory errors when sending a streamed notification
push_stream_shared_memory_size 2M;
# Redirect HTTP connections to HTTPS
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
# HTTPS server
listen 443 ssl;
# Change this to your server's domain name
server_name enghub.io;
# Update these paths to your actual certificate files.
ssl_certificate /path/to/enghub.io/fullchain.pem;
ssl_certificate_key /path/to/enghub.io/privkey.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Set this to your catch all where all your static site content will be.
# We have a static frontend (React) and a dynamic backend (Django) so this
# makes sense to us. If not, adjust accordingly.
root /path/to/static/site;
# The internal Shibboleth Authorizer. Leave this alone.
location = /shibauthorizer {
internal;
include fastcgi_params;
fastcgi_pass unix:/var/run/shibboleth/shibauthorizer.sock;
}
# The Shibboleth responder on /Shibboleth.sso. Again, leave this alone.
location /Shibboleth.sso {
include fastcgi_params;
fastcgi_pass unix:/var/run/shibboleth/shibresponder.sock;
}
# This does not necessarily even have to exist.
# It's mainly for error handling we do not use.
location /shibboleth-sp {
alias /usr/share/shibboleth/;
}
# Change this to your desired push publish endpoint
location ~ /api/v1/push.publish {
push_stream_publisher admin;
push_stream_channels_path $arg_id;
push_stream_store_messages off;
}
# Change this to your desired socket subscribe endpoint
location ~ /api/v1/push.subscribe/(.*) {
push_stream_subscriber;
push_stream_channels_path $1;
}
# Change this to your desired long poll subscription endpoint
location ~ /api/v1/push.subscribe_longpoll/(.*) {
push_stream_subscriber long-polling;
push_stream_channels_path $1;
push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";
push_stream_longpolling_connection_ttl 30s;
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
}
# Change this to your callback code for when a user has logged into Shibboleth
location ~ /api/v1/user.login.callback {
include shib_clear_headers;
shib_request_use_headers on;
shib_request /shibauthorizer;
# Change this to the URL of or socket for your web application
proxy_pass http://localhost:8000;
}
# Change this to the general URL or socket for your application if the user is not visiting a Shibboleth callback URL
location /api {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}