<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName cs.smart-shooter.com

    # Only the React build is public. The rest of the project sits above it.
    DocumentRoot /var/www/html/cs/web/dist

    <Directory /var/www/html/cs/web/dist>
        Require all granted
        AllowOverride None
        Options -Indexes -MultiViews
        FallbackResource /index.html
    </Directory>

    Alias /api /var/www/html/cs/api
    <Directory /var/www/html/cs/api>
        Require all granted
        AllowOverride None
        Options -Indexes -MultiViews
        FallbackResource /api/index.php
        <FilesMatch "\.php$">
            Require all denied
        </FilesMatch>
        <Files "index.php">
            Require all granted
        </Files>
    </Directory>

    # Source, config, CLI scripts, schema: never served.
    <Directory /var/www/html/cs>
        Require all denied
        Options -Indexes
    </Directory>

    Header always set X-Content-Type-Options "nosniff"
    Header always set X-Frame-Options "DENY"

    ErrorLog  ${APACHE_LOG_DIR}/cs-error.log
    CustomLog ${APACHE_LOG_DIR}/cs-access.log combined

SSLCertificateFile /etc/letsencrypt/live/cs.smart-shooter.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/cs.smart-shooter.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
