Advertisement
Guest User

Untitled

a guest
Jan 5th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.24 KB | None | 0 0
  1. upstream optima-curis_dev {
  2.   server unix:/var/www/optima-curis/shared/tmp/sockets/puma.sock fail_timeout=0;
  3. }
  4.  
  5. server {
  6.   charset UTF-8;
  7.   listen 80;
  8.   server_name web.optima-dev.yalantis.com;
  9.  
  10.   client_max_body_size 4G;
  11.   keepalive_timeout 10;
  12.  
  13.   error_page 500 502 504 /500.html;
  14.   error_page 503 @503;
  15.   access_log  /var/log/nginx/optima-curis-access.log;
  16.   error_log   /var/log/nginx/optima-curis-error.log;
  17.  
  18.   location / {
  19.      root /var/www/optima-web;
  20.      try_files $uri /index.html ;
  21.   }
  22.  
  23.   location  ~ ^/(api|api-docs|confirmation/|admin|s/) {
  24.    
  25.     if ($request_method = 'OPTIONS') {
  26.         add_header 'Access-Control-Allow-Origin' '*';
  27.         add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  28.         add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
  29.         add_header 'Access-Control-Max-Age' 1728000;
  30.         add_header 'Content-Type' 'text/plain charset=UTF-8';
  31.         add_header 'Content-Length' 0;
  32.         return 204;
  33.     }
  34.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  35.     proxy_set_header Host $http_host;
  36.     proxy_redirect off;
  37.     proxy_set_header  X-Real-IP         $remote_addr;
  38.     proxy_pass http://optima-curis_dev;
  39.     add_header 'Access-Control-Allow-Origin' '*' always;
  40.   }
  41.  
  42.   location /assets/ {
  43.     alias /var/www/optima-curis/current/public/assets/;
  44.     gzip_static on;
  45.     expires max;
  46.     add_header Cache-Control public;
  47.   }
  48.  
  49.   location /uploads/ {
  50.     alias /var/www/optima-curis/current/public/uploads/;
  51.   }
  52.   location /docs/ {
  53.     alias /var/www/optima-curis/current/public/docs/;
  54.   }
  55.  
  56.   location = /50x.html {
  57.     root html;
  58.   }
  59.  
  60.   location = /404.html {
  61.     root html;
  62.   }
  63.  
  64.   location @503 {
  65.     error_page 405 = /system/maintenance.html;
  66.     if (-f $document_root/system/maintenance.html) {
  67.       rewrite ^(.*)$ /system/maintenance.html break;
  68.     }
  69.     rewrite ^(.*)$ /503.html break;
  70.   }
  71.  
  72.   if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
  73.     return 405;
  74.   }
  75.  
  76.   if (-f $document_root/system/maintenance.html) {
  77.     return 503;
  78.   }
  79.  
  80.   location ~ \.(php)$ {
  81.     return 405;
  82.   }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement