# Main Nginx Configuration File worker_processes auto; pid /run/nginx.pid; events { worker_connections 1024; } http { # Include additional configuration files include /etc/nginx/mime.types; default_type application/octet-stream; # Log settings access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; # Gzip settings (optional) gzip on; gzip_types text/plain application/xml text/css application/javascript; # Include server block configurations include /etc/nginx/conf.d/*.conf; # Localhost without SSL server { listen [::]:80 default_server; listen 80 default_server; root /var/www/html; index index.html index.htm index.php; # Logging error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log combined; # Add CORS headers location / { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With, X-Customer-Number, X-Release-Trace, X-Release-Channel, X-Frontend-Version"; add_header Access-Control-Allow-Credentials true; # If OPTIONS method is needed for preflight if ($request_method = 'OPTIONS') { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; add_header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With, X-Customer-Number, X-Release-Trace, X-Release-Channel, X-Frontend-Version"; return 204; # No Content } # Run the index.php file, no matter what the request URI is try_files $uri $uri/ /index.php?$query_string; } # Location for PHP (using PHP 8.2) location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } # Location for static files location ~* \.(cgi|shtml|phtml)$ { } } }