annotate Sphinx/source/faq/nginx.rst @ 595:14e1e84192b0

typo
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 Jan 2021 09:24:08 +0100
parents a49b3f034580
children a7ac8e5edc89
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _nginx:
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 How can I run Orthanc behind nginx?
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 ===================================
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 Similarly to :ref:`Apache <apache>`, Orthanc can run behind `nginx
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 <https://en.wikipedia.org/wiki/Nginx>`__ through reverse
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 proxying. Here is the configuration snippet for nginx::
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 server {
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 listen 80 default_server;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 ...
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 proxy_set_header HOST $host;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 proxy_set_header X-Real-IP $remote_addr;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 rewrite /orthanc(.*) $1 break;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 ...
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *Note:* Thanks to Qaler for `submitting this information
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 <https://groups.google.com/d/msg/orthanc-users/oTMCM6kElfw/uj0r062mptoJ>`__.
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
114
736d30badda0 large POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
25 You might also wish to adapt the ``client_max_body_size``
736d30badda0 large POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
26 `configuration option of nginx
736d30badda0 large POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
27 <http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size>`__
736d30badda0 large POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
28 to allow the uploading of DICOM files larger than the default 1MB if
736d30badda0 large POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
29 using the :ref:`REST API <sending-dicom-images>` of Orthanc.
736d30badda0 large POST body
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 0
diff changeset
30
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 .. _nginx-cors:
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 Enabling CORS
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 -------------
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
484
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 483
diff changeset
37 Orthanc does not feature built-in support for `cross-origin resource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 483
diff changeset
38 sharing (CORS)
483
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
39 <https://en.wikipedia.org/wiki/Cross-origin_resource_sharing>`_. It
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
40 is however possible to enable it with a nginx reverse proxy. Here is a
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
41 sample configuration for nginx::
0
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 server {
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 listen 80 default_server;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 ...
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 proxy_set_header HOST $host;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 proxy_set_header X-Real-IP $remote_addr;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 rewrite /orthanc(.*) $1 break;
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 add_header 'Access-Control-Allow-Credentials' 'true';
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 add_header 'Access-Control-Allow-Origin' '*';
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 ...
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 }
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 *Note:* Thanks to Fernando for `submitting this information
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 <https://groups.google.com/d/msg/orthanc-users/LH-ej_fB-dw/CmWP4jM3BgAJ>`__.
901e8961f46e initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61