0
|
1 .. _nginx:
|
|
2
|
|
3 How can I run Orthanc behind nginx?
|
|
4 ===================================
|
|
5
|
|
6 Similarly to :ref:`Apache <apache>`, Orthanc can run behind `nginx
|
|
7 <https://en.wikipedia.org/wiki/Nginx>`__ through reverse
|
|
8 proxying. Here is the configuration snippet for nginx::
|
|
9
|
|
10 server {
|
|
11 listen 80 default_server;
|
|
12 ...
|
|
13 location /orthanc/ {
|
|
14 proxy_pass http://localhost:8042;
|
|
15 proxy_set_header HOST $host;
|
|
16 proxy_set_header X-Real-IP $remote_addr;
|
|
17 rewrite /orthanc(.*) $1 break;
|
|
18 }
|
|
19 ...
|
|
20 }
|
|
21
|
|
22 *Note:* Thanks to Qaler for `submitting this information
|
|
23 <https://groups.google.com/d/msg/orthanc-users/oTMCM6kElfw/uj0r062mptoJ>`__.
|
|
24
|
|
25
|
|
26 .. _nginx-cors:
|
|
27
|
|
28 Enabling CORS
|
|
29 -------------
|
|
30
|
|
31 It is also possible to enable `cross-origin resource sharing (CORS)
|
|
32 <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_ with
|
|
33 nginx::
|
|
34
|
|
35 server {
|
|
36 listen 80 default_server;
|
|
37 ...
|
|
38 location /orthanc/ {
|
|
39 proxy_pass http://localhost:8042;
|
|
40 proxy_set_header HOST $host;
|
|
41 proxy_set_header X-Real-IP $remote_addr;
|
|
42 rewrite /orthanc(.*) $1 break;
|
|
43 add_header 'Access-Control-Allow-Credentials' 'true';
|
|
44 add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
|
45 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
|
46 add_header 'Access-Control-Allow-Origin' '*';
|
|
47 }
|
|
48 ...
|
|
49 }
|
|
50
|
|
51 *Note:* Thanks to Fernando for `submitting this information
|
|
52 <https://groups.google.com/d/msg/orthanc-users/LH-ej_fB-dw/CmWP4jM3BgAJ>`__.
|
|
53
|