2024-10-21 10:06:40 +02:00
|
|
|
user www-data;
|
|
|
|
worker_processes auto;
|
|
|
|
pid /run/nginx.pid;
|
|
|
|
include /etc/nginx/modules-enabled/*.conf;
|
2024-10-21 09:58:34 +02:00
|
|
|
|
2024-10-21 10:06:40 +02:00
|
|
|
events {
|
|
|
|
worker_connections 768;
|
|
|
|
}
|
2024-10-21 09:58:34 +02:00
|
|
|
|
2024-10-21 10:06:40 +02:00
|
|
|
http {
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
server_name yourdomain.com;
|
2024-10-21 09:58:34 +02:00
|
|
|
|
2024-10-21 10:06:40 +02:00
|
|
|
location / {
|
|
|
|
# other settings...
|
|
|
|
# Allow CORS for all domains (or specify a particular domain instead of *)
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
|
|
# Allow specific headers
|
|
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
|
|
|
|
# Allow specific methods
|
|
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
|
|
|
add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, Authorization';
|
|
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
|
|
add_header 'Access-Control-Max-Age' 1728000;
|
|
|
|
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
|
|
|
add_header 'Content-Length' 0;
|
|
|
|
return 204;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-10-21 09:58:34 +02:00
|
|
|
|
2024-10-21 10:06:40 +02:00
|
|
|
# Include other server and configuration files
|
|
|
|
include /etc/nginx/conf.d/*.conf;
|
|
|
|
include /etc/nginx/sites-enabled/*;
|
|
|
|
}
|