#map $http_origin $cors_header { # default ""; # "~^https?://[^/]+\.example\.com(:[0-9]+)?$" "$http_origin"; #} server { listen 80; server_name translucent.mesoishop.com; # note that these lines are originally from the "location /" block root /var/www/translucent; #access_log /var/log/nginx/access.log; error_log /var/www/translucent/error.log; index index.php index.html index.htm; add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; location / { #add_header Access-Control-Allow-Origin $cors_header; #add_header X-Frame-Options SAMEORIGIN; try_files $uri $uri/ /index.php?$args; #try_files $uri /index.php?$args; } #error_page 404 /404.html; #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root /var/www/celadoncity; #} location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php74-fpm/php-fpm.sock; #fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_read_timeout 300; add_header Access-Control-Allow-Origin *; proxy_set_header Access-Control-Allow-Origin $http_origin; } }