#0000 - Reorganize and enhance the NGINX configuration structure
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Introduce a refined NGINX configuration template with user, worker settings, and modular include directives. This improves clarity and allows easier integration of additional configuration files, while maintaining existing CORS settings.
This commit is contained in:
Guillaume "B.B." Van Hemmen 2024-10-21 10:06:40 +02:00
parent 6e94306755
commit d15bf1c7d3
Signed by: GuillaumeHemmen
GPG key ID: 7921E64524F7EB35

View file

@ -1,19 +1,25 @@
server {
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
server {
listen 80;
server_name yourdomain.com;
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';
@ -24,4 +30,9 @@ server {
return 204;
}
}
}
}
# Include other server and configuration files
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}