# Data server for Aqua frontend
server
{
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name aqua-data.example.com;

    # / should redirect to the actual website aquadx.hydev.org 
    location / {
        return 301 https://example.com;
    }

    # /maimai should be a file server on /etc/nginx/aqua-data/maimai
    # These are generated using:

    # cd Package/Sinmai_Data/StreamingAssets/A000
    # mkdir -p /etc/nginx/aqua-data/maimai
    # python3 AquaDX/tools/data_convert.py .. /etc/nginx/aqua-data/maimai/meta
    # rm -rf MovieData SoundData
    # (Open AssetRipper and open folder Package/Sinmai_Data)
    # (Export all assets to /tmp/maimai)
    # cd /tmp/maimai/ExportedProject/Assets
    # find -name "*.meta" -delete -print
    # find -name "*.asset" -delete -print
    # cp -r assetbundle Texture2D Resources/common/sprites /etc/nginx/aqua-data/maimai
    # rm -rf /tmp/maimai

    location /maimai {
        root /etc/nginx/aqua-data;

        # Specify UTF-8 encoding
        charset utf-8;

        # CORS allow all
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';

        autoindex on;
    }

    ssl_certificate /dev/null;
    ssl_certificate_key /dev/null;
}