SHARE
TWEET

Untitled

a guest Jun 25th, 2019 164 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set $cors "false";
  2.     if ($http_origin ~* (^http?://([^/]+.)*(example.com|example2.com)$)) {
  3.         set $cors "true";
  4.     }
  5.  
  6.     if ($cors = "true") {
  7.         # Catch all incase there's a request method we're not dealing with properly
  8.         add_header 'Access-Control-Allow-Origin' "$http_origin";
  9.     }
  10.      
  11. server {
  12.     listen 80;
  13.     listen 443 ssl http2;
  14.     server_name .api.homestead;
  15.     root "/home/vagrant/api/public";
  16.  
  17.     index index.html index.htm index.php;
  18.  
  19.     charset utf-8;
  20.  
  21.     set $cors "false";
  22.     if ($http_origin ~* (^http?://([^/]+.)*(domain.com|localhost:8080))) {
  23.         set $cors "true";
  24.     }
  25.  
  26.     if ($cors = "true") {
  27.         # Catch all incase there's a request method we're not dealing with properly
  28.         add_header 'Access-Control-Allow-Origin' "$http_origin";
  29.     }
  30.  
  31.  
  32.  
  33.     location / {
  34.         allow 192.168.10.1;
  35.         deny all;
  36.  
  37.         try_files $uri $uri/ /index.php?$query_string;
  38.  
  39.         add_header 0 false;
  40.     }
  41.  
  42.  
  43.  
  44.  
  45.     location = /favicon.ico { access_log off; log_not_found off; }
  46.     location = /robots.txt  { access_log off; log_not_found off; }
  47.  
  48.     access_log off;
  49.     error_log  /var/log/nginx/api.homestead-error.log error;
  50.  
  51.     sendfile off;
  52.  
  53.     client_max_body_size 100m;
  54.  
  55.     location ~ .php$ {
  56.         fastcgi_split_path_info ^(.+.php)(/.+)$;
  57.         fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  58.         fastcgi_index index.php;
  59.         include fastcgi_params;
  60.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  61.  
  62.  
  63.         fastcgi_intercept_errors off;
  64.         fastcgi_buffer_size 16k;
  65.         fastcgi_buffers 4 16k;
  66.         fastcgi_connect_timeout 300;
  67.         fastcgi_send_timeout 300;
  68.         fastcgi_read_timeout 300;
  69.     }
  70.  
  71.     location ~ /.ht {
  72.         deny all;
  73.     }
  74.  
  75.     ssl_certificate     /etc/nginx/ssl/api.homestead.crt;
  76.     ssl_certificate_key /etc/nginx/ssl/api.homestead.key;
  77. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top