# VirtualHost definition for the Arvados API server

<VirtualHost *:80>
  ServerName @@API_HOSTNAME@@.@@ARVADOS_DOMAIN@@
  ServerAdmin sysadmin@curoverse.com

  RedirectPermanent / https://@@API_HOSTNAME@@.@@ARVADOS_DOMAIN@@/

  LogLevel warn
  ErrorLog  ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

<VirtualHost *:443>
  ServerName @@API_HOSTNAME@@.@@ARVADOS_DOMAIN@@
  ServerAdmin sysadmin@curoverse.com

  RailsEnv production
  RackBaseURI /
  RailsAppSpawnerIdleTime 1200

  # Enable streaming
  PassengerBufferResponse off

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html
  DocumentRoot /usr/src/arvados/services/api/public

  LogLevel warn
  ErrorLog  ${APACHE_LOG_DIR}/ssl_error.log
  CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

  <Directory /usr/src/arvados/services/api/public>
    Options Indexes FollowSymLinks MultiViews IncludesNoExec
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  <IfModule mod_ssl.c>
    SSLEngine on
    # SSLCertificateChainFile /etc/ssl/certs/startcom.sub.class1.server.ca.pem
    # SSLCACertificateFile    /etc/ssl/certs/startcom.ca.pem
    SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
  </IfModule>

</VirtualHost>