-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgalaxy.j2
154 lines (119 loc) · 4.19 KB
/
galaxy.j2
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{% for alias in aliases.split(',') %}
server {
listen 443 ssl;
server_name {{ alias }};
return 307 $scheme://{{inventory_hostname}}$request_uri;
}
{% endfor %}
server {
# Listen on port 443
listen *:443 ssl default_server;
# The virtualhost is our domain name
server_name "{{ inventory_hostname }}";
# Our log files will go here.
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 0;
# The most important location block, by default all requests are sent to uWSGI
location / {
# This is the backend to send the requests to.
uwsgi_pass 127.0.0.1:8080;
uwsgi_param UWSGI_SCHEME $scheme;
include uwsgi_params;
error_page 504 =200 @maintenance;
error_page 502 =200 @maintenance;
error_page 401 =200 @noaccess;
error_page 404 =200 @notfound;
}
location /_x_accel_redirect/ {
add_header Access-Control-Allow-Origin $upstream_http_access_control_allow_origin;
internal;
alias /;
}
location @maintenance {
root /srv/galaxy/server/static/;
try_files $uri /maintenance.html =503;
}
location @noaccess {
root /srv/galaxy/server/static/;
try_files $uri /401.html =503;
}
location @notfound {
root /srv/galaxy/server/static/;
try_files $uri /404.html =503;
}
# Static files can be more efficiently served by Nginx. Why send the
# request to uWSGI which should be spending its time doing more useful
# things like serving Galaxy!
location /static {
alias {{ galaxy_server_dir }}/static;
expires 24h;
}
# The style directory is in a slightly different location
location /static/style {
alias {{ galaxy_server_dir }}/static/style;
expires 24h;
}
location /static/scripts/bundled {
alias {{ galaxy_server_dir }}/static/dist;
expires 24h;
}
# In Galaxy instances started with run.sh, many config files are
# automatically copied around. The welcome page is one of them. In
# production, this step is skipped, so we will manually alias that.
#location /static/welcome.html {
# alias {{ galaxy_server_dir }}/static/welcome.html.sample;
# expires 24h;
#}
# serve visualization and interactive environment plugin static content
location ~ ^/plugins/(?<plug_type>[^/]+?)/((?<vis_d>[^/_]*)_?)?(?<vis_name>[^/]*?)/static/(?<static_file>.*?)$ {
alias {{ galaxy_server_dir }}/config/plugins/$plug_type/;
try_files $vis_d/${vis_d}_${vis_name}/static/$static_file
$vis_d/static/$static_file =404;
}
# https://docs.galaxyproject.org/en/master/admin/special_topics/gtn.html
location /training-material/ {
proxy_pass https://training.galaxyproject.org/training-material/;
}
location /reports/ {
uwsgi_pass 127.0.0.1:9001;
uwsgi_param UWSGI_SCHEME $scheme;
include uwsgi_params;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd-reports;
}
location /galaxy-terms/ {
alias /srv/galaxy/server/static/tos/;
}
location /docs/ {
alias /srv/galaxy/server/static/docs/;
}
location /tos/ {
proxy_pass http://127.0.0.1:8081/;
}
location /nga/ {
proxy_pass http://127.0.0.1:8888/;
}
location /robots.txt {
alias {{ galaxy_server_dir }}/static/robots.txt;
}
location /favicon.ico {
alias {{ galaxy_server_dir }}/static/favicon.ico;
}
location /jenkins {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Fix the "It appears that your reverse proxy set up is broken" error.
proxy_pass http://127.0.0.1:4000;
proxy_read_timeout 90;
}
location /server_status {
stub_status on;
access_log off;
allow 127.0.0.1;
allow {{ galaxy_ip }};
deny all;
}
}