<Directory /usr/share/graphite>
    AllowOverride none
    Require all granted
</Directory>

<VirtualHost *:80>
    ServerName graphite.cloud.fedoraproject.org
    ServerAlias graphite.fedorainfracloud.org
    DocumentRoot "/usr/share/graphite/webapp"
    ErrorLog /var/log/httpd/graphite-web-error.log
    CustomLog /var/log/httpd/graphite-web-access.log common

    Header set Access-Control-Allow-Origin "*"
   
    WSGIScriptAlias / /usr/share/graphite/graphite-web.wsgi
    WSGIImportScript /usr/share/graphite/graphite-web.wsgi process-group=%{GLOBAL} application-group=%{GLOBAL}

    <Location "/content/">
        SetHandler None
    </Location>

    Alias /media/ "/usr/lib/python2.7/site-packages/django/contrib/admin/media/"
    <Location "/media/">
        SetHandler None
    </Location>

    # certbot/letsencrypt
    RewriteEngine on
    RewriteRule ^/\.well-known/(.*) /srv/web/acme-challenge/.well-known/$1 [L]
</VirtualHost>

<VirtualHost {{public_ip}}:443 _default_:443>
  ServerName graphite.cloud.fedoraproject.org

  SSLEngine on
  SSLCertificateFile    /etc/letsencrypt/live/graphite.cloud.fedoraproject.org/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/graphite.cloud.fedoraproject.org/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/graphite.cloud.fedoraproject.org/fullchain.pem
  SSLHonorCipherOrder On
  SSLCipherSuite {{ ssl_ciphers }}
  SSLProtocol {{ ssl_protocols }}

  ProxyPass / http://graphite.cloud.fedoraproject.org/
  ProxyPassReverse / http://graphite.cloud.fedoraproject.org/
</VirtualHost>
