File: //etc/nginx/sites-enabled_24/api.ghayatcom.conf
server {
listen 443 ssl;
server_name api.ghayatcom.com;
root /mnt/data/ghayatcom/ghayatcom-api/public;
index index.php index.html;
ssl_certificate /etc/nginx/ssl/ghayatcom.pem;
ssl_certificate_key /etc/nginx/ssl/ghayatcom.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# Deny directory listing (equivalent to Options -Indexes)
autoindex off;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# PHP-FPM configuration
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Error and Access Logs
error_log /var/log/nginx/ghayatcom_api_error.log;
access_log /var/log/nginx/ghayatcom_api_access.log;
}
server {
listen 80;
server_name api.ghayatcom.com;
return 301 https://$host$request_uri;
}