<VirtualHost *:80>
    ServerName mcgram.online
    DocumentRoot /var/www/mcgram
    
    <Directory /var/www/mcgram>
        AllowOverride All
        Require all granted
    </Directory>
    
    # Redirect to HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>

<VirtualHost *:443>
    ServerName mcgram.online
    DocumentRoot /var/www/mcgram
    
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/mcgram.crt
    SSLCertificateKeyFile /etc/ssl/private/mcgram.key
    
    <Directory /var/www/mcgram>
        AllowOverride All
        Require all granted
    </Directory>
    
    # Security headers
    Header always set X-Content-Type-Options nosniff
    Header always set X-Frame-Options DENY
    Header always set X-XSS-Protection "1; mode=block"
    Header always set Referrer-Policy "strict-origin-when-cross-origin"
</VirtualHost>
