<VirtualHost *:80>
    ServerName ams.example.com
    Redirect permanent / https://ams.example.com/
</VirtualHost>

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName ams.example.com
    DocumentRoot /var/www/powerams/current/public

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/ams.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/ams.example.com/privkey.pem
    SSLProtocol -all +TLSv1.2 +TLSv1.3
    Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"

    <Directory /var/www/powerams/current/public>
        Options -Indexes -ExecCGI
        AllowOverride FileInfo Limit Options
        Require all granted
        DirectoryIndex index.php
    </Directory>

    <Directory /var/www/powerams/current>
        Require all denied
    </Directory>

    <FilesMatch "^index\.php$">
        SetHandler "proxy:unix:/run/php/php8.2-fpm-powerams.sock|fcgi://localhost/"
    </FilesMatch>

    ErrorLog ${APACHE_LOG_DIR}/powerams-error.log
    CustomLog ${APACHE_LOG_DIR}/powerams-access.log combined
</VirtualHost>
</IfModule>
