File: //etc/nginx/sites-enabled/ghayatcom.conf
server {
listen 443 ssl;
server_name ghayatcom.com;
root /mnt/data/ghayatcom/frontend;
index index.html index.htm index.php;
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;
# Security Headers
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Permissions-Policy "geolocation=self" always;
# Example for future:
# add_header Content-Security-Policy "default-src 'self'; img-src * data: https:;" always;
# Deny directory listing (equivalent to Options -Indexes)
autoindex off;
location / {
try_files $uri $uri/ =404;
}
# 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_error.log;
access_log /var/log/nginx/ghayatcom_access.log;
}
server {
listen 80;
server_name ghayatcom.com;
return 301 https://$host$request_uri;
}