| Line 0
          
      
      
        Link Here | 
          
            
              | 0 | -  | 1 | upstream hypnotoad { | 
            
              |  |  | 2 |     server 127.0.0.1:8080; | 
            
              | 3 | } | 
            
              | 4 |  | 
            
              | 5 | server { | 
            
              | 6 |     listen 444;                          ## listen for ipv4 | 
            
              | 7 |     listen [::]:444 default ipv6only=on; ## listen for ipv6 | 
            
              | 8 |     proxy_connect_timeout 120s; #High value because some API requests (show all borrowers) take a LOT of time. | 
            
              | 9 |     proxy_read_timeout 120s; | 
            
              | 10 |     proxy_send_timeout 120s; | 
            
              | 11 |  | 
            
              | 12 |     #server_name <your_Koha_DNS_Name>; | 
            
              | 13 |     access_log /home/koha/koha-dev/var/log/kohaapi.access.log; | 
            
              | 14 |     error_log  /home/koha/koha-dev/var/log/kohaapi.error.log error; | 
            
              | 15 |  | 
            
              | 16 |     root /home/koha/kohaclone/api/; | 
            
              | 17 |     index index.html; | 
            
              | 18 |  | 
            
              | 19 |     ssl on; | 
            
              | 20 |     ssl_certificate     ssl/cert.pem; | 
            
              | 21 |     ssl_certificate_key ssl/key.pem; | 
            
              | 22 |  | 
            
              | 23 |     ssl_session_timeout 5m; | 
            
              | 24 |  | 
            
              | 25 |     ssl_protocols SSLv3 TLSv1; | 
            
              | 26 |     ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; | 
            
              | 27 |     ssl_prefer_server_ciphers on; | 
            
              | 28 |  | 
            
              | 29 |     #Redirect root to the Swagger documentation | 
            
              | 30 |     location = / { | 
            
              | 31 |         rewrite ^/(.*) $scheme://$host:$server_port/v1/doc/; | 
            
              | 32 |     } | 
            
              | 33 |     #Don't proxy doc | 
            
              | 34 |     location ^~ /v1/doc/ { | 
            
              | 35 |          | 
            
              | 36 |     } | 
            
              | 37 |     # and no proxying the swagger.json | 
            
              | 38 |     location = /v1/swagger.json { | 
            
              | 39 |          | 
            
              | 40 |     } | 
            
              | 41 |  | 
            
              | 42 |     #Proxy everything else | 
            
              | 43 |     location /v1/ { | 
            
              | 44 |         proxy_pass http://hypnotoad; | 
            
              | 45 |         proxy_http_version 1.1; | 
            
              | 46 |         proxy_set_header Upgrade $http_upgrade; | 
            
              | 47 |         proxy_set_header Connection "upgrade"; | 
            
              | 48 |         proxy_set_header Host $host; | 
            
              | 49 |         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | 
            
              | 50 |         proxy_set_header X-Forwarded-Proto $scheme; | 
            
              | 51 |     } | 
            
              | 52 | } |