Files
api/services/nginx/nginx.conf
T
Jepp9350 ca52d3b248 Update API endpoints, add wash certificate handling
Replaced legacy 'nnks.truckwash.dk' endpoint with 'api.truckwash.dk' across the codebase for consistency. Implemented a feature to handle certificate downloads, including file serving and validation. Updated PHP configuration to support additional dependencies like PHPMailer, and introduced necessary route and configuration changes for wash certificate processing.
2025-01-31 09:25:18 +01:00

88 lines
2.3 KiB
Nginx Configuration File

# 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;
# Redirect HTTP to HTTPS
server {
listen 80;
server_name api.truckwash.dk;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name api.truckwash.dk;
# SSL certificates
ssl_certificate /etc/letsencrypt/live/api.truckwash.dk/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.truckwash.dk/privkey.pem;
# Enable SSL options
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
# Logging
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log combined;
# Index file
index index.php index.html index.htm;
# Root directory (public- uses index.php)
root /var/www/html;
# Location block for PHP files
location ^~ / {
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With";
add_header Access-Control-Allow-Credentials true;
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";
return 204;
}
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME index.php;
}
# Deny access to .htaccess files
location ~ /\.ht {
deny all;
}
# Deny access to hidden files
location ~ /\. {
deny all;
}
}
}