Mercurial > hg > orthanc-book
annotate Sphinx/source/faq/nginx.rst @ 919:5c1ce758f748
uclouvain
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 17 Mar 2023 12:58:14 +0100 |
parents | a49b3f034580 |
children | a7ac8e5edc89 |
rev | line source |
---|---|
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/ { | |
261
857f4870fd7f
nginx: localhost to 127.0.0.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
14 proxy_pass http://127.0.0.1:8042; |
0 | 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 | |
114 | 25 You might also wish to adapt the ``client_max_body_size`` |
26 `configuration option of nginx | |
27 <http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size>`__ | |
28 to allow the uploading of DICOM files larger than the default 1MB if | |
29 using the :ref:`REST API <sending-dicom-images>` of Orthanc. | |
30 | |
0 | 31 |
32 .. _nginx-cors: | |
33 | |
34 Enabling CORS | |
35 ------------- | |
36 | |
484 | 37 Orthanc does not feature built-in support for `cross-origin resource |
38 sharing (CORS) | |
483 | 39 <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_. It |
40 is however possible to enable it with a nginx reverse proxy. Here is a | |
41 sample configuration for nginx:: | |
0 | 42 |
43 server { | |
44 listen 80 default_server; | |
45 ... | |
46 location /orthanc/ { | |
261
857f4870fd7f
nginx: localhost to 127.0.0.1
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
114
diff
changeset
|
47 proxy_pass http://127.0.0.1:8042; |
0 | 48 proxy_set_header HOST $host; |
49 proxy_set_header X-Real-IP $remote_addr; | |
50 rewrite /orthanc(.*) $1 break; | |
51 add_header 'Access-Control-Allow-Credentials' 'true'; | |
52 add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; | |
53 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; | |
54 add_header 'Access-Control-Allow-Origin' '*'; | |
55 } | |
56 ... | |
57 } | |
58 | |
59 *Note:* Thanks to Fernando for `submitting this information | |
60 <https://groups.google.com/d/msg/orthanc-users/LH-ej_fB-dw/CmWP4jM3BgAJ>`__. | |
61 |