prod setup
This commit is contained in:
@ -6,8 +6,6 @@ error_log /var/log/nginx/error.log;
|
||||
|
||||
index index.php;
|
||||
|
||||
charset utf-8;
|
||||
|
||||
error_page 404 /index.php;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/thetempusproject.com.pem;
|
||||
@ -17,7 +15,7 @@ location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
|
||||
location = /robots.txt {
|
||||
allow all;
|
||||
log_not_found off;
|
||||
@ -40,7 +38,7 @@ location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location ~* \.(?:js|css|png|jpg|gif|ico|woff|ttf|woff2)$ {
|
||||
location ~* \.(?:js|css|png|jpg|gif|ico|woff|tff|woff2|min.css.map)$ {
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
@ -69,6 +67,27 @@ location /errors/ {
|
||||
try_files $uri /index.php?error=$uri;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
# Handle CORS for all requests
|
||||
if ($request_method = 'POST') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length, Content-Range' always;
|
||||
}
|
||||
# Handle preflight requests
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization, DNT, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range' always;
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8' always;
|
||||
return 204; # Return no content for preflight
|
||||
}
|
||||
|
||||
rewrite ^/(.+)$ /index.php?url=$1&$args;
|
||||
}
|
||||
|
||||
location / {
|
||||
rewrite ^/(.+)$ /index.php?url=$1&$args;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user